Showing posts with label sql. Show all posts
Showing posts with label sql. Show all posts
Sunday, July 17, 2016
Sql Server tSql: DELETE statement executes but won't delete
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/sql-server-tsql-delete-statemen/
Thursday, February 26, 2015
I have no words for how bad this is
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/i-have-no-words-for-how-bad-this-is/
Wednesday, November 19, 2014
How to use Excel and tSQL to help you Generate Code
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/how-to-use-excel-and-tsql-to-help-you/
Labels:
automate,
C#,
Code,
concatenate,
concatenation,
data,
enumeration,
Excel,
generate,
generation,
insert,
sql,
SSMS,
Table,
tSQL,
update
Sunday, May 25, 2014
Simple Class Creator and DTO Generator
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/simple-class-creator-and-dto-generator/
Thursday, June 13, 2013
SSRS Windows Integrated Security: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
This article still exists!
It has simply moved to:
Wednesday, October 24, 2012
How to Kill all Processes for a Specific Database
Usually you would just use the Activity Monitor like shown below...
The idea behind this query is to first find out what you database's ID is, enter the ID in the where clause and generate the KILL statements. Copy and paste the KILL statements and execute all of them at once. You will be warned about killing your own connection though like this:
Msg 6104, Level 16, State 1, Line 1
Cannot use KILL to kill your own process.
No worries though you can just kill that process in the Activity Monitor or just close the query window.
Enjoy
![]() |
| The mundane repetition of right click each process and selecting Kill Process becomes annoying after the n_th process. |
...buuuuut if you need to restore your Dev Database with fresh data, you need to kill all of the individual connections/processes before attempting a restore. Well when you are doing development work you can have over 10+ connections and using the Activity Monitor is very annoying to close all of them. Therefore I have come up with the following tSQL query:
SELECT dbid, db_name(dbid) as DatabaseName, spid, KillStatement = 'KILL ' + CAST(spid AS varchar(10)) + '; ' FROM sys.sysprocesses WHERE dbid = 15 -- Put your Databases ID here
The idea behind this query is to first find out what you database's ID is, enter the ID in the where clause and generate the KILL statements. Copy and paste the KILL statements and execute all of them at once. You will be warned about killing your own connection though like this:
Msg 6104, Level 16, State 1, Line 1
Cannot use KILL to kill your own process.
No worries though you can just kill that process in the Activity Monitor or just close the query window.
Enjoy
Monday, September 10, 2012
Easy Way to Start/Stop SQL Server on a Multipurpose Machine
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/easy-way-to-startstop-sql-server-on/
Friday, August 31, 2012
Entity Framework: Executing SQL Strings
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/entity-framework-executing-sql-strings/
Tuesday, August 7, 2012
How to get Filename and File Extension from a Column with tSQL
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/how-to-get-filename-and-file-extension/
Monday, April 30, 2012
SQL Server: String or binary data would be truncated.
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/sql-server-string-or-binary-data-would/
Wednesday, January 18, 2012
SQL Server: Attaching a Second Copy of a Database that Exists Already in the Same Server
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/sql-server-attaching-second-copy-of/
Sunday, January 15, 2012
SQL Server 2008 R2 will not install - Unhandled Exception has occurred in your application.
The post you are looking for still exists, it was just moved here: http://obscureproblemsandgotchas.com/uncategorized/sql-server-2008-r2-will-not-insta/
Tuesday, January 10, 2012
Straight to the Point: Query for Database and Table Sizes
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/straight-to-point-query-for-database/
Query SQL Server using PowerShell
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/query-sql-server-using-powershe/
Monday, January 9, 2012
Selecting Random Date Between a Date Range with tSQL
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/selecting-random-date-between-date/
Thursday, September 1, 2011
SQL Server: Tips on Declaring a Decimal Data Type
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/sql-server-tips-on-declaring-decima/
Wednesday, July 20, 2011
How to connect to a remote SQL Server
I posted about this on Stackoverflow.com
http://stackoverflow.com/questions/2486610/how-to-connect-to-sql-server-from-another-computer/6765184#6765184
I think I will revisit this later to find the correct 1 way solution to this problem.
http://stackoverflow.com/questions/2486610/how-to-connect-to-sql-server-from-another-computer/6765184#6765184
I think I will revisit this later to find the correct 1 way solution to this problem.
Sunday, June 26, 2011
How to install sql server management studio 2008 component only
I posted an answer to this question on Stack Overflow here
Friday, June 10, 2011
UPDATE SELECT FROM JOIN
This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/update-select-from-join/
Subscribe to:
Posts (Atom)
