bigator

Archive for the ‘T-SQL’ Category

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 […]

bigatorFebruary 6, 2013 · bigatorKhilitchandra Prajapati · bigatorNo Comments
bigatorTags: , , , , , ,  · Posted in: Business Intelligence, Free, General, Interview QA, Quick Fix, Quick Tips, Script, SQL Server, SQL Server 2012, SQLServerPedia, T-SQL, Training, Tutorial

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 […]

bigatorJanuary 28, 2013 · bigatorKhilitchandra Prajapati · bigatorOne Comment
bigatorTags: , , , , ,  · Posted in: Business Intelligence, Free, General, Interview QA, Quick Fix, Quick Tips, Script, SQL Server, SQL Server 2012, SQLServerPedia, SSAS, SSIS, SSRS, T-SQL, Tutorial

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 […]

bigatorJanuary 25, 2013 · bigatorKhilitchandra Prajapati · bigatorNo Comments
bigatorTags: , , , , , , , , ,  · Posted in: Business Intelligence, Free, General, Interview QA, Quick Fix, Quick Tips, Script, SQL Server, SQL Server 2012, SSIS, T-SQL, Tutorial

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 […]

bigatorJune 27, 2012 · bigatorKhilitchandra Prajapati · bigatorOne Comment
bigatorTags: , , , , ,  · Posted in: General, Interview QA, Quick Fix, Quick Tips, Script, SQL Server, SQL Server 2012, T-SQL, Tutorial

What happens to IDENTITY Column Value When SQL Transaction Fails??

Hi All, I would like to share a simple interview question. This is very simple yet many developers overlooks or not taking care of it. Do you know what happens to identity value if transaction fails? Do you think that identity value of table is unchanged after failure? Before looking at the solution below, try […]

bigatorMarch 15, 2012 · bigatorKhilitchandra Prajapati · bigatorNo Comments
bigatorTags: , , ,  · Posted in: Interview QA, Quick Tips, SQL Server, T-SQL

Best Practices : Writing Stored Procedures

Hi All, I would like to share a handy list which I found today from my old collection during files clean-up. These are few quick tips that every developer should bear in mind while writing T-SQL codes particularly Stored Procedures. It’s always hard to find the best version of such list but we can definitely […]

bigatorMarch 14, 2012 · bigatorKhilitchandra Prajapati · bigator2 Comments
bigatorTags: , , ,  · Posted in: SQL Server, Suggestion, T-SQL

“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 […]

bigatorFebruary 21, 2012 · bigatorKhilitchandra Prajapati · bigatorNo Comments
bigatorTags: ,  · Posted in: General, Quick Tips, SQL Server, T-SQL

When my SQL table was updated???

Here is very tiny SQL query which will help you find out when the tables are modified in the SQL server database. First you try the * (get all the columns) and then choose the selected ones. – List all the tables updated in SQL Server (in desc order) Use your Database Name Select * […]

bigatorJanuary 27, 2012 · bigatorKhilitchandra Prajapati · bigatorOne Comment
bigatorTags: ,  · Posted in: General, Interview QA, Quick Tips, SQL Server, Suggestion, T-SQL


bigator