-
I came across an issue some time ago when a job of mine was regularly failing with a strange error - Unable to open the physical file “\\<path>”. Operating system error 5: "5(error not found)" . The job in question ran monthly, and took a backup of our Data Warehouse database to...
-
A Leap year contains an extra day so there are 366 days. There are many ways to find out whether the year is a Leap year. If the value of is_leap_year is 1 it is a Leap year otherwise it is not a Leap year. Method 1 : General method declare @year int set @year=2000 select case when @year%400=0 then 1...
-
We are about to start the logic testing of TSQL Challenge 44 – Identify products that belong to each unique color combinations . We have created a sandbox for the tricky testing and you can find it here . Please take a look at the tricky data and expected results and let us know if you find anything...
-
We are about to start the logic testing of TSQL Challenge 43 . We have created a sandbox for the tricky testing and you can find it here .
-
In the Query Analyser, set the Result mode to Text (Press CTRL+T) and run the following code set nocount on select space(17-len(replicate(char(37),no)))+ replicate(char(37),no*2-1) from ( select top 10 row_number() over (order by name) as no from sysobjects ) as t union all select space(14)+replicate...
-
Pinal Dave in his blog posted this about using a column name and column number in the Order by clause. He made some valid points on why the second method should not be used. However, there is a case in which second method can be useful I had already blogged about Dynamic PIVOT in which you can pass the...
-
We are about to start the logic testing of TSQL Challenge 42 – Transform rows to columns with dynamic positioning . We have created a sandbox for the tricky testing and you can find it here . Please take a look at the tricky data and expected results and let us know if you find anything incorrect.
-
We are about to start the logic testing of TSQL Challenge 40 - Convert string representation of numeric values from binary to hexadecimal format. . We have created a sandbox for the tricky testing and you can find it here . Please take a look at the tricky data and expected results and let us know if...
-
In the SQL Server forums, I see questions complaining that BULK INSERT is not taking care of check constraints. There are also some other questions related to BULK INSERT. Here I summarise them and explain 1 Enabling Check contraint - Use the option check_constraints create table test (id int, amount...
-
One of the applications we worked on recently had to deal with storing TSQL queries in a table and executing them based on some business logic. It was not a very complicated project, but the development team had a tough time with the formatting of the queries stored in the table. This was a huge problem...
-
We are about to start the logic testing of TSQL Challenge 39 - Calculate Gross Profit by Item using FIFO method . We have created a sandbox for the tricky testing and you can find it here . Please take a look at the tricky data and expected results and let us know if you find anything incorrect.
-
I have already blogged about the usage of BULK INSERT in this post http://beyondrelational.com/blogs/madhivanan/archive/2010/03/17/bulk-insert-to-table-with-specific-columns.aspx You can use BULK INSERT command to import data from a file to a table. However if the field seperator is a comma and data...
-
We are about to start the logic testing of TSQL Challenge 37 . We have created a sandbox for the tricky testing and you can find it here .
-
We are about to start the logic testing of TSQL Challenge 36 . We have created a sandbox for the tricky testing and you can find it here .
-
We are about to start the logic testing of TSQL Challenge 35 . We have created a sandbox for the tricky testing and you can find it here .