Microsoft’s whitepaper on Optimising TempDB in SQL Server 2005 contains a lot of useful information for anyone trying to push the performance of SQL Server 2005. Along with the internal improvements to tempdb, there are a number of things a database administrator should do as part of any installation: Increase the number of data files […]
You are browsing archives for
Tag: T-SQL
SQL Server 2005 List all IDENTITY columns
Here is a simple bit of T-SQL that will display the names of all the IDENTITY columns in a database: SELECT SCHEMA_NAME( OBJECTPROPERTY( OBJECT_ID, ‘SCHEMAID’ )) AS SCHEMA_NAME, nbsp; OBJECT_NAME( OBJECT_ID ) AS TABLE_NAME, NAME AS COLUMN_NAME FROM SYS.COLUMNS WHERE COLUMNPROPERTY(OBJECT_ID, NAME, ‘IsIdentity’) = 1
Return Codes, Exit Codes, and %errorlevel%
Gah! The one thing that always gets me with working with so many different programming langauges (C#, T-SQL, Perl, VB, DOS) is that they each tend to refer to the same thing with a slightly different name. (If you read Perl: same foo, different bar). Today when stepping out of T-SQL land and into DOS, […]
That warm fuzzy feeling
While I find my full-time job constantly challenging, its also like any job: limited to the current projects and development. This is not a downside, just a fact that what you do in your job will be limited by the scope of your work. Sure there’s daily study, and home projects, things you choose to […]
Snippet: Select the Time portion from a datetime
Earlier on I wrote about how you can Select just the date part from a DateTime or SmallDateTime data type. (See [story:t-sql-date-without-time]) Using the CONVERT( … , … , style ) function we can specify the style attribute, that lets us specify to SQL Server (using style 14 or 114) that we just want the […]
PromptSQL Intellisense for SQL Server user and system objects
I don’t know how long I’ve been waiting for this, but someone has finally built an Intellisense tool for SQL Server Management Studio & Query Analyzer. If you’ve been using Visual Studio.Net 2003 or 2005, you’ll know how useful Intellisense is in other programming languages (it’s like auto-complete in Word). I don’t know why it’s […]
SQL Server 2005 Database Snapshots
This is a really neat addition to SQL Server 2005. Database Snapshots are essentially a read-only, static view of an existing database, without duplicating all the data on disk. I use this feature a lot when I upgrade database schemas, or make major changes to data, and need to be able to compare the changes […]
Q&A: How do I declare a Stored Procedure parameter as NOT NULL ?
Q: How do I declare a Stored Procedure’s parameter as NOT NULL ? A: You can’t. Remarks in the CREATE PROCEDURE t-sql documentation states: Parameters are nullable by default. If a NULL parameter value is passed and that parameter is used in a CREATE or ALTER TABLE statement in which the column referenced does not […]
COLLATE
COLLATE Keyword used to define string collation used for a database, column or server. Can also be used to cast the collation of a column or variable when used in a t-sql expression. SQL Server 2000 and SQL Server 2005 allow you to use Windows Collation Names or SQL Collation Names. To see a list […]
Changing a Database File Logical Name
Applies to: SQL Server 2000, SQL Server 2005 (Yukon) It’s pretty often I see the need for a database to be renames. Sometimes its because a developer has given their database a very generic name, or sometimes becuase the use of the database has shifted. Renaming a database is a pretty easy task (make sure […]