Category Archives: SQL Server 2008

How to read long text in sql server

Sometime you might want to read the entire text in a particular table column. If you execute the command select longColumn from MyTable You will see that you can only read the first 50 characters are so. If you are … Continue reading

Posted in SQL Server 2008 | Leave a comment

Running query against remote server

If you want to run a SQL Query against a remote server for example a different machine on the same network, you may want to use the flowing code. First link the server, then use OPENQUERY to run the query … Continue reading

Posted in SQL Server 2008, Uncategorized | Tagged , , , , , | 2 Comments

SQL Server Management Studio 2008 on Windows Server 2008

How to start SQL Server Management Studio on Windows Server 2008 As you might have come through this nausense, you install SQL Server Management Studio 2008 (SSMS) on Windows Server 2008 and you can not start it. There is no … Continue reading

Posted in Software Development, SQL Server 2008 | Leave a comment

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