Skip to main content
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
Results tagged with
Search options not deleted user 8876

All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag, like sql-server-2016, since it is often relevant to the question.

7 votes
3 answers
24k views

Storing NULL versus storing '' in a varchar column

I realize this may be marked as duplicate, but I'm specifically asking in relation to SQL Server 2005 I have read conflicting advice on the internet so I'm asking here. Specifically in SQL Server 2 …
MrVimes's user avatar
  • 629
4 votes
1 answer
204 views

Reclaim space from dropped column when there isn't enough space for index rebuild

I dropped a char(10) column from a table that has about 111 million rows (30gb data, 11gb index) I then ran an index rebuild on the clustered index. This ate up all the space on the drive containing …
MrVimes's user avatar
  • 629
2 votes
1 answer
85 views

Changing char(10) to char(3) grew table even after cleantable and shrinkfile

In a largely experimental attempt to reduce table space usage I altered a char(10) column to char(3) (The column's contents are never more than three characters long) Steps (Not carried out in a sin …
MrVimes's user avatar
  • 629
7 votes
1 answer
6k views

Appending backups while overwriting expired sets

I've been reading up on this, but the online documentation is a bit difficult to understand and seems awkwardly written. For example the INIT, NOINIT. One says it will try to overwrite everything. Th …
MrVimes's user avatar
  • 629
1 vote
1 answer
62 views

Is there a better way than this to split a string and get the first substring?

I'm trying to cut off everything after a certain character (in this case '&') and if there is no occurence of that character, get the entire string. select left(@str,isnull(nullif(charindex('&',@str) …
MrVimes's user avatar
  • 629
2 votes
3 answers
3k views

Moving data into an archive table and reducing the size of the original table

On a SQL Server I inherited, there is a 55GB database on a 70GB drive. There are many small tables, and one big table that is 50GB in size (approx 36GB data, 15GB index). The log file is on a differen …
MrVimes's user avatar
  • 629
4 votes
1 answer
595 views

Is it wise to drop fixed-length columns to free up space?

I have a huge table in SQL Server 2005. (The table is about 40gb) I am looking for the safest and most pain-free way to either free up space, or delay its growth. The table has three fixed length (c …
MrVimes's user avatar
  • 629
3 votes
4 answers
8k views

Index fragmentation increased significantly after rebuild

I've googled this and I know that some people say index fragmentation doesn't matter, but they go on to describe scenarios where it might matter. Mine might be such a scenario. I have an index on a …
MrVimes's user avatar
  • 629
3 votes
2 answers
5k views

Trying to check if a string contains a number exclusively

I have been trying to write a function to check if a string contains a number without that number being part of a bigger number (in other words if the number being searched for is '6' and the string i …
MrVimes's user avatar
  • 629
0 votes

Trying to check if a string contains a number exclusively

I have since re-written my function as follows. Edit: I completed this before seeing Solomon Rutzky's reply to my question. His reply works and is better than mine. But I will leave this answer as …
MrVimes's user avatar
  • 629