Statistics

Total Posts: 34
This Year: 0
This Month: 0
This Week: 0
Comments: 174


RSS 2.0   SocialTwist Tell-a-Friend


Admin

Sign In

Navigation


Recent Posts


On this page....

How to limit the data returned by each columns in a SELECT statement?
How to swap data between two columns of a table in SQL Server?
Smarter the better – SQL Server tips – part 03
Smarter the Better – SQL Server Tips – Part 02
Smarter the Better – SQL Server Tips – Part 01
Finding Stored Procedure Create and Modified Date in SQL Server
Converting a comma separated string having IDs to row result
How to determine the size of a table in SQL Server database?
Understanding and Using PIVOT clause in SQL Server 2005
Another way to export SQL Server table data to a Text file
Not able to change Server Log-on Mode in SQL Server
Converting Row Data as Comma Separated String
How to select random rows from an SQL Table?
Row Size limitation in SQL 2000 and 2005
How to eliminate duplicate records from a database table?
SQL Server Permissions - Fixing Orphaned Users

Archives

 Full Archives By Category
 2007 Calendar View
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Categories

CDOSYS (1) Classic ASP (10) Command Line (2) Databases (16) Excel (1) HTML (1) IIS (10) Indexing Service (1) Internet Explorer (7) Media Streaming (1) MS.Net (2) SQA (7) SQL Server (16) Windows OS (2)

Blogroll - Fav Blogs


Acknowledgments

DasBlog Theme Design by: Tom Watts
E-mail: Send mail to the author(s)
Theme Image by: dreamLogic

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Technology Blog

This article is specific to MS SQL Server. There can be various need based scenarios where the data returned by the SELECT statement should be limited to certain length for the columns of data type VARCHAR(MAX), NVARCHAR(MAX), VARBINARY(MAX), TEXT, NTEXT, and IMAGE data types. This can be achieved using SUBSTRING or LEFT functions for specific columns in SELECT statement. But if you have a SELECT statement having many columns of the data types specified before and you want to apply data returned length limitation for each column, the better option would be to use TEXTSIZE command.
Friday, November 13, 2009 11:44:59 PM (India Standard Time, UTC+05:30)
When we talk about swapping of data between two columns of a table in SQL Server, most of us think of writing SQL scripts in Stored Procedure to achieve it. Well, is it really required? Can a one line statement be written to swap data between two columns in a table? The answer is yes. In this article I cover a simple technique to swap data between two columns of a table.
Sunday, August 16, 2009 11:15:17 PM (India Standard Time, UTC+05:30)
This is in continuation to my previous post on SQL Server Tips.
Saturday, June 13, 2009 11:12:33 PM (India Standard Time, UTC+05:30)
This is in continuation to my previous post on SQL Server Tips. Use table variables instead of temporary tables. Include SET NOCOUNT ON statement into your stored procedures to stop the message indicating the number of rows affected by a T-SQL statement.
Sunday, May 17, 2009 12:22:01 AM (India Standard Time, UTC+05:30)
There are many occasions where a SQL Server Developer uses scripts which take longer to execute. I would rather say a wrong choice or approach in writing scripts caused the execution of the script longer. There are smarter ways to achieve results. In this post I will try to consolidate few tips on smarter SQL Server programming.
Sunday, March 08, 2009 7:34:17 PM (India Standard Time, UTC+05:30)
We all have created Stored Procedures in SQL Server. We keep doing regular updates on the applications using SQL Server database. The real problem comes when the application need to be made live and the database stored procedure is required to be synced with the live server. Unless there is no track of change monitored, it would be difficult while deploying the updates and upgrades in SQL SPs on to the live server. Now the question is more clear... Can I find the last modified date for a stored procedure in SQL Server?
Monday, March 02, 2009 6:35:32 PM (India Standard Time, UTC+05:30)
This post is in continuation to my previous post on “Converting Row Data as Comma Separated String”, which is to demonstrate exactly the opposite process “Converting a Comma Separated String Having IDs to Row Result”.
Friday, February 13, 2009 8:51:01 PM (India Standard Time, UTC+05:30)
You know how many fields are there in the table. You know the size of each field in the table. You know how many records are there in a table. But do you really know the size of a table? How much space is that table really taking?
Thursday, February 12, 2009 11:46:10 AM (India Standard Time, UTC+05:30)
SQL Server 2005 has lots of new features, of which one is PIVOT clause. This is similar to Pivot tables in MS Excel and Matrix Control in Reporting Service. Here is a simple example demonstrating how to use PIVOT clause. I am right now taking a simple example. There are scenarios where there could be a need to write a big stored procedure to build a Pivot table in lower versions of SQL Server.
Friday, February 06, 2009 9:09:00 PM (India Standard Time, UTC+05:30)
No doubt that a DTS or SSIS package can be used to export SQL Server table data to a text file. The below article is to demonstrate another way to export SQL Server table data to a text file using xp_cmdshell extended stored procedure (This is with reference to SQL Server 2005 and above).
Friday, January 02, 2009 2:22:02 PM (India Standard Time, UTC+05:30)
The SQL Server was installed with “Windows Only” log-on mode. We have logged-in as admin and try to change the log-on mode using server registration property to Mixed Mode (SQL Server and Windows). When we apply the setting and revisit the registration property, the change is not applied. How do we change the logon mode to Mixed mode?
Tuesday, December 30, 2008 6:11:12 PM (India Standard Time, UTC+05:30)
# Saturday, December 20, 2008
One of my office mate Ranjan did some research on internet and found a simple and quick solution to have row data as comma separated string.
Saturday, December 20, 2008 10:46:47 PM (India Standard Time, UTC+05:30)
# Friday, December 19, 2008
IN SQL Server, it is easy to select one random record or a sequence of random records from a database table. For example if you have requirement to pick a single quiz winner randomly from the database table or you are making an online test application and need to pick X number of questions randomly from the database table; you can certainly use the below SQL queries…
Friday, December 19, 2008 10:45:52 PM (India Standard Time, UTC+05:30)
# Wednesday, December 17, 2008
IN SQL Server 2000 and 2005, while creating a table it is possible to create as many number of columns with VARCHAR data type of size 8000. If you are using Query analyzer, you may notice a warning message reading… “Table has been created but its maximum row size (NumberofBytes) exceeds the maximum number of bytes per row (8060).”
Wednesday, December 17, 2008 10:44:49 PM (India Standard Time, UTC+05:30)
This is a general problem faced by a maintenance team. While importing/exporting data to/from/between databases, the PK is removed accidentally and the table now has lots of duplicate records. The big question for the support staff is how to clean the database? It's simple...
Monday, December 15, 2008 10:43:34 PM (India Standard Time, UTC+05:30)
# Wednesday, December 10, 2008
The database backup is taken from the development environment and the BAK file is restored on the production server. On restoring the database from the BAK file, the database users with DB Owner rights are also restored along with the database. But checking the security >> user list in SQL server does not display these users. The SQL server does not allow deleting the users from the database manually as they own objects in the DB. SQL Server does not allow creating the DB user and assign DB Owner rights for the user to the restored DB.
Wednesday, December 10, 2008 10:41:28 PM (India Standard Time, UTC+05:30)