|
|
|
|
|
|
Get SQL Server Details ( Edition , License ... etc ).
|
Total Hit (2907) |
How to obtain details about the server using the new SERVERPROPERTY system function?
«code LangId=6»SELECT CAST( SERVERPROPERTY( 'MachineName' ) AS varchar( 30 ) ) AS MachineName ,
CAST( SERVERPROPERTY( 'InstanceName' ) AS varchar( 30 ) ) AS Instance ,
CAST( SERVERPROPERTY( 'P
....Read More |
Rating
|
|
|
|
|
UDF in CHECK & DEFAULT CONSTRAINTS.
|
Total Hit (3272) |
User-defined functions in SQL2000 provide a powerful way to reuse code / logic. This example shows how you can use UDFs in CHECK & DEFAULT constraints of a table.
|
Rating
|
|
|
|
SQL Server Lock ( NOLOCK and ROWLOCK )
|
Total Hit (12559) |
Relational databases, like Microsoft's SQL Server, use locks to prevent multiple users from making conflicting modifications to a set of data. When a set of data is locked by a user, no other users can modify that same set of data until the first user finishes modifying the data and relinquishes the
....Read More |
Rating
|
|
|
Handling database file growth
|
Total Hit (2747) |
Scripts to automatically get notified if a database grew due to the autogrowth option being turned on.
|
Rating
|
|
|
How to reset Identity of Autonumber column?
|
Total Hit (4877) |
There are two ways to reset identity field
1) Use TRUNCATE TABLE <mytable> rather than DELETE. This is a non-logged operation, however, and may not be what you need.
2) Use the DBCC CHECKIDENT command to reseed your identity value:
DBCC CHECKIDENT('mytable', RESEED, 0) -- next row inserted
....Read More |
Rating
|
|
|
generate INSERT statements from existing data.
|
Total Hit (3201) |
This procedure generates INSERT statements using existing data from the given tables and views. Later, you can use these INSERT statements to generate the data. It's very useful when you have to ship or package a database application. This procedure also comes in handy when you have to send sample d
....Read More |
Rating
|
|
|
Find out the nth highest number in a column.
|
Total Hit (2646) |
Ever wondered how to find out the second highest salary from the employees table? Or how to find out the third oldest employee in the company? Here is a stored procedure which accepts the table name, column name, and nth number and displays the nth highest number from the given column.
....Read More |
Rating
|
|
|
Getting the second recent date from a set of values.
|
Total Hit (1815) |
ANSI & T-SQL specific solutions for getting the 2nd recent date from a set of values. This can be extended to answer nth date from a set of values but the ANSI version gets unwieldy & has to be modified for bigger values.
|
Rating
|
|
|
|
|
Strip dirty characters from a numeric string.
|
Total Hit (1736) |
A technique to search & remove dirty characters from a numeric string. This problem shows how you can simplify the solution by looking at only what is needed.
|
Rating
|
|
|
|
|
|
|
|
|
|
|
Moving Average Example #1.
|
Total Hit (2309) |
This example shows how to solve the Moving Average problem using a correlated query.
|
Rating
|
|
|
|