Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
SQL Server 2005 (major build version 9.00.xxxx). Please also tag sql-server.
5
votes
3
answers
4k
views
Why can't I use newid() in a user-defined table-valued function?
I recently found out that SQL Server 2005 doesn't allow the use of newid() within user-defined functions. Why is this?
I have an alternate solution that suits my needs, so I'm not looking for ways to …
5
votes
2
answers
127
views
How do you handle adding nullable columns to each other in a query?
Currently whenever I write a query that is adding columns that can contain nulls I resort to wrapping each field in isnull or coalesce, such as coalesce(score1,0) + coalesce(score2,0).
Is there a bett …
19
votes
4
answers
7k
views
Why would someone put `where 1=1` in a query?
I came across a view in our database today where the first statement in the where clause was where 1 = 1. Shouldn't this return true for every record? Why would someone write this if it isn't filterin …
9
votes
3
answers
3k
views
Is there a way to programmatically script all objects associated with a given table?
I know that in SQL management studio I can right click a table/trigger/key and script object as.... Is there a way to do this programmatically, given an object's name?
If so, is there a way to find a …
20
votes
2
answers
42k
views
What are database statistics, and how can I benefit from them?
I've heard mention of statistics that SQL Server keeps by default. What are they tracking, and how can I use this information to improve my database?
20
votes
4
answers
15k
views
Is there any benefit of a primary key that comprises all columns of the table?
I have a table with four columns that are all non-nullable, and the data is such that all four are needed to distinguish a unique record. This means that if I were to make a primary key, it would need …
17
votes
2
answers
2k
views
Is there any tangible difference between a unique clustered index and a clustered primary key?
I understand that there may be a difference in meaning or intent between the two, but are there any behavioral or performance differences between a clustered primary key and a clustered unique index?