Skip to main content

Posts

Showing posts with the label SQL 2012

How To See Logs Of Dropped Tables From The Database in MS SQL.

Here, I will explain you how you can see logs of users. Step 1 : First, create a new database with name "test". Step 2 : Create a new table. Step 3 : Now, go and drop the table by running the following command. Step 4 : Now, select your database under Object Explorer and go to Reports >> Standard Reports >> Schema Changes History. Step 5 : You will then see the schema change history. The report will show you who has dropped this table. Finally, you can locate the user activity with the help of log.

Using IIF Logical Function in MS SQL.

The IIF function, which is available in SQL Server 2012, returns one of the two values depending upon whether the Boolean expression evaluates to either True or False. DECLARE @FirstArgument INT = 10 DECLARE @SecondArgument INT = 20 SELECT IIF ( @FirstArgument > @SecondArgument , 'TRUE', 'FALSE' ) AS [Output]

CHOOSE Logical Function in MS SQL.

The CHOOSE function, which is available in SQL Server 2012, will return the item at the specified index from the list of values which are available. In this example we have 3 values and we are asking to select the third value in the list which is "SQL Server 2012". SELECT 'Programming Language' = CHOOSE(3, 'C#', 'Java','Python')