-
Recent Posts
Recent Comments
Archives
- December 2020
- May 2018
- April 2018
- January 2018
- October 2017
- April 2017
- February 2017
- January 2017
- November 2016
- September 2016
- August 2016
- July 2016
- June 2016
- May 2016
- April 2016
- March 2016
- February 2016
- December 2015
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- September 2014
- August 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- November 2011
- October 2011
- September 2011
- August 2011
- May 2011
- April 2011
Categories
Meta
Category Archives: SQL Server 2008
Optimize your SQL Query using temporary table
If you are using JOIN which considerably slows your query or report, you may create a temporary table inside your stored procedure. Use this temporary table which contains filter data to use in the report. This will make the query … Continue reading
Posted in SQL Server 2008
Leave a comment
Row_Number SQL Server
Row_Number or Sequence Generator in SQL Server Is is used to generate a sequence number or a row number in a result table. That is if you want to run a query and you rank certain records in certain order, … Continue reading
Posted in SQL Server 2008
Leave a comment
Quick SQL Scripts
Find start date of the year in SQL SELECT Cast(Datepart(yy,Getdate()) AS VARCHAR(4)) + '-1-1' year
Posted in SQL Server 2008
Leave a comment
compare two null values in sql
If you compare two values and either of them can be null or one of them null equal (=) operator does not work. Equal operator is not null sensitive. To compare the two you have to changed null to valid … Continue reading
Posted in SQL Server 2008
Leave a comment
SQL Server 2005 Instances do not show up in Server 2008 R2
I updated my SQL Server 2005 to SQL Server 2008. Everything worked great. After a few weaks later, I tried to connect to the db in SQL Server Management Studio after I had restarted the PC and it won’t connect. … Continue reading
Posted in SQL Server 2008
Leave a comment
JOIN using LIKE in SQL
Q. Can I join tow tables using like (more flexible criteria) than exact match? Ans. Yes [sql] — create test table first create table #A ( id varchar(10) ) create table #b( number varchar(5) ) insert into #A values(‘123’) insert … Continue reading
Posted in SQL Server 2008
Leave a comment
BETWEEN DATES SQL Server 2008
When dealing with dates, remember there is not such field as date in SQL Server 2005/2008. There is datetime field. For reference there is a date type in MySQL which I think is very useful. There could be problems when … Continue reading
Posted in SQL Server 2008
1 Comment
The column ‘LOCK_ID’ was specified multiple times for ‘BB’.
SQL Server 2008 Error Message: The column ‘LOCK_ID’ was specified multiple times for ‘BB’. Example: select BB.LDC_ACCT_ID from ( select * from STUDENTS S JOIN RECORDS R on S.STUDENT_ID = R.STUDENT_ID ) as TEMP If you run this query in … Continue reading
Posted in SQL Server 2008
Leave a comment
Error Locating Server Instance Specified
Connecting to the server through a third party software/interface can give you the following error. [SQL Native Client]SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. [SQL Native Client]Login timeout expired [SQL Native Client]An error has occurred while establishing a connection … Continue reading
Posted in SQL Server 2008, Uncategorized
Leave a comment
SQL Select * into from
If you want to copy or backup your table in the database, use the following SQL command. select * into newtable from oldtable The new table is created on the fly. You do not need to create it. A more … Continue reading
Posted in SQL Server 2008
Leave a comment