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 82954

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.

1 vote
3 answers
5k views

Sql Where statement dynamic with case

I have a Stored Procedure where I pass a value of 0,1,2. 0= no where 1= Duration >0 2= Duration =0 select * from Table where case when @duration =1 then Duration else 1 end >0 this works howe …
Andre DeMattia's user avatar
1 vote
1 answer
481 views

SQL Server Try Catch Transastion

I need to know if the T-SQL below is correct to roll back if something bad happens. I first create a temp table IF OBJECT_ID(N'tempdb..#LocalSummary') IS NOT NULL DROP TABLE #LocalSummary …
Andre DeMattia's user avatar
2 votes
2 answers
944 views

SQL Server Database Suspect with Memory table

Today my database seems suspect. I am running SQL Server 2016 with memory tables. The below code won't work to fix the suspect. SQL Server keeps saying I have to restore. Any ideas? EXEC sp_resetstat …
Andre DeMattia's user avatar
3 votes
0 answers
861 views

SQL Server 2014 log file very large [duplicate]

I have a database with a memory optimized table and table partitions. The log file is over 300GB in one .ldf file, and another 40GB in another. I have tried shrinking the db, files, log DBCC SHRINKF …
Andre DeMattia's user avatar