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 2573

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.

57 votes
Accepted

Changing column width

If you're doing it through a T-SQL statement such as below, then no table drop will occur and you can safely do it in a production environment: alter table <table> alter column <column> nvarchar(bigg …
Derek's user avatar
  • 1,671
5 votes
2 answers
12k views

Changing Domain on SQL Server

I currently have some SQL Servers that sit on a sub-domain. We are eliminating that sub-domain and moving everything to the regular domain. As far as SQL Server configuration goes, is there anything …
Derek's user avatar
  • 1,671
0 votes

SQL Server Index: One new table joining to three old tables, how to?

That seems fine to me. But the only way to be sure is to implement and test.
Derek's user avatar
  • 1,671
0 votes

SQL Server 2008 R2 MERGE statement to replace single INSERT AND UPDATE statement combined

I'd suspect that your table would have to be incredibly large and improperly indexed or have hundreds-to-thousands of concurrent users running this proc (the merge uses 1 less lock) to really see any …
Derek's user avatar
  • 1,671
0 votes

Why is Row Overflow not working on SQL Server 2005

It's a warning, not an error. As long as the row is within the 2GB (I believe) limit, it should have inserted. Can you verify that it was indeed inserted?
Derek's user avatar
  • 1,671
8 votes
Accepted

Why is this Full Outer Join not working?

You should do an isnull on both policynumbers so that you can group properly. Since it's an outer-join, there's the possibility of one side of the join being NULL while still having data. select sum …
Derek's user avatar
  • 1,671
3 votes
Accepted

Increased RAM, Worse Performance

Thanks to everyone for your help. After pouring through some execution plans, it turns out there is a JOIN that is being processed differently based on the amount of RAM available. With less RAM it e …
Derek's user avatar
  • 1,671
9 votes
2 answers
2k views

Increased RAM, Worse Performance

Setup: Windows Server 2008 R2 SQL Server 2008 R2 SP1 240GB RAM TempDB is 8x16GB data files w/out auto-grow (128GB total) Physical/Stand-alone Server This server is used for ETL processing. We jus …
Derek's user avatar
  • 1,671
3 votes
3 answers
329 views

SQL Server - Index Including PK

Lets assume we have a table as follows: PK -- nonclustered primary key Col1 -- unique clustered Col2 Col3 Is this index: nonclustered index on (Col2, Col3) any different from this index: nonclu …
Derek's user avatar
  • 1,671
23 votes

Why is there still a varchar data type?

In addition to the answers addressing standards and compatibility, one should also keep in mind performance. While disk space is readily accepted as cheap, DBAs/Developers often ignore the fact that q …
Derek's user avatar
  • 1,671
1 vote
1 answer
228 views

Migrating or Synchronizing SSAS Changes

Assume you have 2 SSAS databases, DB1 and DB2, that are identical. Now they branch off. Changes A and B are made to DB1 and changes C and D are made to DB2. Is there an easy method to migrate change …
Derek's user avatar
  • 1,671
0 votes

Change column data type across database

No, if you want to alter the column type you're going to have to use an ALTER COLUMN statement. Well, that's not true - you can drop the table and recreate it - but ALTER COLUMN is clearly superior :) …
Derek's user avatar
  • 1,671
1 vote
Accepted

T SQL Table Valued Function to Split a Column on commas

Re-worked it slightly... DECLARE @FoundIndex INT DECLARE @ReturnValue VARCHAR(MAX) SET @FoundIndex = CHARINDEX(@delimiter, @String) WHILE (@FoundIndex <> 0) BEGIN SET @ReturnValue = SUBSTRING …
Derek's user avatar
  • 1,671
5 votes
3 answers
6k views

Rollback group of DDL statements

Working in SQL Server 2008 R2, I am trying to rollback a set of DDL statements as a group (think of an upgrade script for a database), but am running into trouble. Take the following code: begin try …
Derek's user avatar
  • 1,671
20 votes

Limit results to the first 2 ranking rows

select * from ( SELECT Subject, Name, RANK() OVER (PARTITION BY Subject ORDER BY Score DESC) as RN FROM Table ) a where a.RN <= 2
Derek's user avatar
  • 1,671