Retrieving id of inserted record: What to use @@IDENTITY or SCOPE_IDENTITY() or OUTPUT

Hi guys, This seems very basic information but need to know properly. Issue: I need to find out or have the id of the records which I inserted in table. Analysis: This requirement seems very simple but there could be various cases where you would not get the correct id just by using @@IDENTITY function. Think …

Continue reading ‘Retrieving id of inserted record: What to use @@IDENTITY or SCOPE_IDENTITY() or OUTPUT’ »

The Story of Precision, Scale, and Length in SQL Server

Hi guys, Did you ever faced issues with BIG mathematical figures – related to either overflow or any  other arithmetic errors. This may be applicable to SQL arithmetic operations or arithmetic  operations you do with SQL table in SSIS etc. Well, check 1 more time, if you have any issues in your database design related …

Continue reading ‘The Story of Precision, Scale, and Length in SQL Server’ »

Tracking Down Ghost Characters: WHERE Clause Does Not Work Properly In T-SQL Query

Hi guys, I would like to share an experience with you when I was working on 1 SSIS related issue. Scenario was: I have to exclude some records from Table A by matching some keys of Table B.  Table A Year Month CustomerCode <Extra Columns> 2012 JAN CX1000   2012 JAN CX2000   2012 JAN …

Continue reading ‘Tracking Down Ghost Characters: WHERE Clause Does Not Work Properly In T-SQL Query’ »

View is not showing newly added column in table

Hi all, This is for the people who still use “Select * From Table” in their SQL Views. I don’t know what is the reason that you are using this way to create your views, but you could be the victim of this scenario (see… what title says). Let me show you how you can …

Continue reading ‘View is not showing newly added column in table’ »

Enhanced “Generate Scripts” dialog box in SQL Server 2012 RC0

Hi All, I have been monitoring the “Generate Scripts…” functionality of SQL Server Database. One thing bothers me for last few years or since SQL Server 2005 is that once I right-click on any database -> Tasks -> Generate Scripts, I would expect to generate scripts only for that database which I have selected. But …

Continue reading ‘Enhanced “Generate Scripts” dialog box in SQL Server 2012 RC0’ »