|
|
|
|
|
|
Get SQL Server Details ( Edition , License ... etc ).
|
Total Hit (2980) |
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 (3374) |
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 (13222) |
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 (2817) |
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 (4956) |
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 (3293) |
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 (2717) |
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
|
|
|
|
How to transfer database diagrams to a different database?
|
Total Hit (2748) |
Database diagrams are stored in the 'dtproperties' table within the database. So, database diagrams can be transferred to a different database, by transferring the contents of this table.
For example , run the following query to transfer the diagram named 'MyTableDesign' from 'pubs' database to '
....Read More |
Rating
|
|
|
|
|
|
How to search all columns of all tables in a database for a keyword?
|
Total Hit (3600) |
While browsing the SQL Server newsgroups, every once in a while, I see a request for a script that can search all the columns of all the tables in a given database for a specific keyword. I never took such posts seriously. But then recently, one of my network administrators was troubleshooting a pro
....Read More |
Rating
|
|
|
Code to find out the statement that caused the trigger to fire!
|
Total Hit (1873) |
Sometimes you may want to find out what exact statement that updated your table. Or you may want to find out how the WHERE clause of the DELETE statement (Executed by someone) looked like.
DBCC INPUTBUFFER can provide you with this kind of information. You can create a trigger on your table, tha
....Read More |
Rating
|
|
|
Procedure to import SQL Server error log into a table (SQL 2000)
|
Total Hit (3369) |
This procedure reads the SQL Server error log using sp_readerrorlog and imports the error log's contents into a specified table. It accepts three parameters:
@log_name is the name of the table into which the error log will be imported
@log_number is the error log number, 0 is default and refers
....Read More |
Rating
|
|
|
Stored procedure to generate a simple or complex random password
|
Total Hit (3149) |
This procedure generates random passwords using RAND() function. It can be configured to generate a simple or a complex password. You can also customize the length of the password generated. Complex passwords will include upper and lower case letters, numbers and special characters. See the code to
....Read More |
Rating
|
|
|
|
How to read value from remote registry ?
|
Total Hit (3685) |
This article explains how to use a Visual Basic application to access the registry on a remote computer in conjunction with the Windows application programming interface (API).
«B»Requirements«/B»
You need the following hardware and software to perform the procedures in this article:
A Micro
....Read More |
Rating
|
|
|
|
|