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 answers only not deleted user 60085

An operation that removes all rows in a table without causing any triggered action

1 vote

Using dynamic query to loop through Db for a truncate statement

#Table to truncate $TableToTruncate = 'dbo.TestTruncate' #QueryToExecute $QueryToExecute = "if OBJECT_ID('$TableToTruncate') is not null Truncate table $TableToTruncate" #Loop through each database foreach … ($sqlDatabase in $sqlServer.databases) { Write-Host Looking at $sqlDatabase.name #Skip if system database if ($sqlDatabase.IsSystemObject -eq $false) { #Invoke the truncate command …
Scott Hodgin - Retired's user avatar
2 votes

Backup a single table

I'd recommend using the BCP utility. From that documentation: Copying table rows into a data file (with a trusted connection) Basic This example creates a data file named StockItemTransactions_cha …
Scott Hodgin - Retired's user avatar
6 votes

SQL Server TRUNCATE TABLE permissions

You could use this technique by Jonathan Kehayias to create a stored procedure that will allow the user to TRUNCATE a table. … As Johathan says: "You can't grant truncate because for whatever reason, that permission doesn't exist. …
Scott Hodgin - Retired's user avatar
4 votes

Truncating a table with a foreign key constraint - SQL Server

The documentation for TRUNCATE TABLE (Transact-SQL) is fairly clear on this topic. … (You can truncate a table that has a foreign key that references itself.) …
Scott Hodgin - Retired's user avatar
2 votes
Accepted

Why do we add NO_TRUNCATE and NORECOVERY options while taking tail log Backup?

According to Tail-Log Backups (SQL Server) - (highlighting mine) If the database is online and you plan to perform a restore operation on the database, begin by backing up the tail of the log. …
Scott Hodgin - Retired's user avatar