Reputation
4,304
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
3 21 39
Newest
 Caucus
Impact
~230k people reached

2h
comment Problem with clustered index? Or bad indexes? (SQL Server 2008 R2)
Set Bad Habits to kick - putting NOLOCK everywhere - it is NOT RECOMMENDED to use this everywhere - quite the contrary!
Jul
18
comment How to add new named instance in SQL Server 2012
Adding a new instance means installing again - with a new instance name - no way around this.
Jul
16
comment Restore SQL Server 2008 database onto SQL Server 2014?
What is the compatibility level of that source database? SQL Server 2012 and newer do not support compatibility level 80 (SQL Server 2000) anymore ....
Jul
12
comment Stored procedure return -1
The stored procedure return value typically indicates the number of rows affected by your operation in the stored procedure. If you're not inserting, updating or deleting anything, then there are no rows affected, thus the return value might be -1 - this is not an error!
Jul
12
comment Stored procedure return -1
Side note: you should not use the sp_ prefix for your stored procedures. Microsoft has reserved that prefix for its own use (see Naming Stored Procedures), and you do run the risk of a name clash sometime in the future. It's also bad for your stored procedure performance. It's best to just simply avoid sp_ and use something else as a prefix - or no prefix at all!
Jul
7
comment Create new server in SQL Server instance
Install SQL Server on this machine a third time - pick an instance name that's not already in use
May
9
comment Strange SSIS-Package problem ( ASYNC_NETWORK_IO)
Set Bad Habits to kick - putting NOLOCK everywhere - it is NOT RECOMMENDED to use this everywhere - quite the contrary!
Apr
15
comment Restoring a backup of a database from SQL Server 2014 into SQL Server 2012
@BuahahaXD: NO - the compatibility level does NOT change the internal database structures. This does not help - you just CANNOT do this.
Apr
14
comment How to restore mdf file in sql server 2005?
what error message?!?!? I don't see anything .....
Apr
1
comment Execution Plan : Table Insert Cost 90% vs Clustured Index Insert Cost 86%
For a great many reasons, I would argue any serious table in SQL Server should always have a clustered index - therefore, that discussion is kinda moot..... heaps (tables without CI) have serious drawbacks and performance penalties - too many to even bother - use a CI - always.
Mar
25
comment Differentiate SQL Server Express from SQL Server installed in a server
@RayofCommand: it might violate the Principle of Least Surprise - but it's possible ! :-)
Mar
11
comment Keep Execution Plan in Cache - SQL Server 2012
It's going to automatically stay in memory - if you use it frequently enough, and if there isn't any "memory pressure" (too little memory) on the server. You cannot really force a plan to stay fixed in cache - it will be tossed out if memory is too tight....
Feb
21
comment Different runtimes using parameter vs. constant
WHY is DATE_CREATED not a proper DATE datatype?? Please always use the most appropriate datatype - and for a date - that's DATE but certainly not a VARCHAR type!
Feb
10
comment NVARCHAR column as PRIMARY KEY or as UNIQUE column
Actually, NVARCHAR(20) is 40 bytes in size (max), and since it's variable-length column, it's not really the best choice for a clustered index. ID_CODE being a BIGINT IDENTITY would be the much better choice here!
Jan
30
comment Soccer league ER diagram (implementing a many to many relationship)
have some m:n relationships which I know shouldn't exist - WHY do you think m:n relationships shouldn't exist?!?!?!?! Those are just a fact of life! Nothing wrong with that! Where did you "learn" that???
Jan
29
comment Trigger AFTER INSERT on tables with different columns
It's a column (not collumn - one l is quite enough!)
Jan
29
comment When does SQL Server acquire locks?
Another point: by default SQL Server will use the finest grained locks possible - row-level locks for individual rows, or possibly page-level locks when selecting ranges in a clustered table. But if your session acquires more than 5000 locks, SQL Server will do a lock escalation and switch to a table-level locking, which is undesirable in a production system, since not even reads are possible from that table anymore, until the locks are released (until the transaction is done). So try to keep your updates in chunks of less than 5000 at a time
Jan
29
comment When does SQL Server acquire locks?
The exclusive locks for update and delete operations are acquired when needed and retained until the end of the transaction. The main point is trying to keep your transaction short and sweet to minimize locking time
Jan
20
comment T-SQL — Why do ALTER and UPDATE statement only run when separated into their own batch?
Just a brief side note: GO is not a (SQL) statement - it's a separator that is specific to SQL Server Mgmt Studio.
Jan
15
comment Subquery returned more than 1 value. This is not permitted + Trigger Error SQL Server
Your trigger has MAJOR FLAW in that you seem to assume it'll be called once per row - that is not the case. The trigger will fire once per statement, so if your UPDATE statements affects 25 rows, you'll get the trigger fired once, but then Inserted and Deleted will each contain 25 rows. Which of those 25 rows will your code select? It's non-deterministic. You need to rewrite your trigger to take this into account!