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’ »

Adding a new column to an existing table??? Check the rules first

Hi All, So, you are standing at the gates where you need to add a new COLUMN to an existing table. Well, there are 2 cases: Table is empty Table contains data If “Table is empty” then you are still in design-phase of that table. Add new column whichever the way you know 🙂 E.g. …

Continue reading ‘Adding a new column to an existing table??? Check the rules first’ »

Search Country & Location Information based on IP Address

Hi All, Once I ran into the situation where I have to find out the CityCountry name & location (Longitude, Longitude) based on the IP address. This was not difficult but rather not straight-forward as IP addresses are stored into database table as strings which is very obvious because there are no standard data type …

Continue reading ‘Search Country & Location Information based on IP Address’ »

“Specify Values for Template Parameters” in SQL Server

Hi All, SQL Server Management Studio provides a dialog box named “Specify Values for Template Parameters” for filling values for the template you have used. This is very handy if you always like interface based interactions with components. E.g. When you choose any template from Template Explorer, you will see template with lots of place-holders …

Continue reading ‘“Specify Values for Template Parameters” in SQL Server’ »

FileTables in SQL Server 2012

Hi All, FileTables feature introduced in SQL Server 2012. This feature is built on the top of FileStream feature of SQL Server 2012. I published the introduction of FileStream in my previous post. FileTables allows us to store files and documents in special tables in SQL Server called FileTables, but access them from Windows applications …

Continue reading ‘FileTables in SQL Server 2012’ »

Auto Generate (Some particular)Change Scripts in SSMS

Hi All, How are you doing? We all know that Change is a rule of life …. And pretty much that applied to SQL Server as well 🙂 Yes, my point is to find out the changes we have done in current SQL Server so we can deliver into the next environment i.e. UAT/Test or …

Continue reading ‘Auto Generate (Some particular)Change Scripts in SSMS’ »