Contents tagged with TSQL
-
SQL Server TSQL Get Last Identity Seed After Insert
Use SCOPE_IDENTITY() if you are inserting a single row and want to retrieve the ID that was generated.
CREATE TABLE #a(identity_column INT IDENTITY(1,1), x CHAR(1));
INSERT #a(x) VALUES('a'); … more
-
Prevent Object Create in Master Database in SQL Server
USE masterGOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TRIGGER DDL_PreventObjectCreationInMasterDBON DATABASEFOR CREATE_TABLE, CREATE_VIEW, CREATE_PROCEDURE,CREATE_FUNCTIONASBEGIN-- SET … more
-
Querying SQL Server Agent Job History Data
https://www.mssqltips.com/sqlservertip/2850/querying-sql-server-agent-job-history-data/
-
SQL Server Get Job Instance Id with TSQL
https://www.sqlservercentral.com/forums/topic/job-instance-id
-
SQL Server: TSQL Select Into with Identity
SELECT IDENTITY(INT,1,1) AS ID,* INTO NewTable FROM ExistingTable more
-
SQL Server Memory Consumption by Object
https://www.sqlserverscience.com/performance/memory-consumption-by-object/ more
-
SQL: How an OR Short Circuits
https://sqlstudies.com/2019/06/17/its-interesting-how-an-or-short-circuits/ more
-
SQL and NULL Mistakes
https://www.red-gate.com/hub/product-learning/sql-prompt/the-null-mistake-and-other-sql-null-heresies more
-
Does the case expression short circuit
https://sqlstudies.com/2019/06/13/does-the-case-statement-short-circuit/ more
-
SQL Server: Get Operating System Information with TSQL
SELECT windows_release, windows_service_pack_level, windows_sku, os_language_version FROM sys.dm_os_windows_info
exec master..xp_cmdshell 'systeminfo'
SELECT @@version
exec xp_msver more
-
Connect Python to SQL
https://datascienceplus.com/connect-python-to-sql/ more
-
Run stored procedures in parallel
https://dba.stackexchange.com/questions/173265/run-stored-procedures-in-parallel
-
SQL to DAX Conversion
SELECT TOP(1) InventTrans.CustVendAC
FROM InventTrans
WHERE InventTrans.DataAreaId = 'DAT'
AND InventTrans.StatusReceipt = 1
AND … more
-
SQL Server: Datefirst Setting For Determining Day of Week Number
https://docs.microsoft.com/en-us/sql/t-sql/statements/set-datefirst-transact-sql?view=sql-server-2017 more
-
SQL Server TSQL Else if Syntax
http://dba.fyicenter.com/faq/sql_server/IF_ELSE_IF_ELSE_Statement_Structures.html more
-
SQL Server Format Function
https://database.guide/3-ways-to-get-the-month-name-from-a-date-in-sql-server-t-sql/ more
-
Create Table DDL via TSQL
https://www.sqlservercentral.com/articles/create-table-ddl-via-tsql-1
-
Visual Representation of SQL Joins
https://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins
-
SQL Server: Deleting Files with TSQL
http://www.kodyaz.com/articles/delete-file-from-sql-server-xp-cmdshell-ole-automation-procedures.aspx
https://stackoverflow.com/questions/43269779/how-to-delete-files-on-the-directory-via-ms-sql- … more
-
SQL Server 2012 T-SQL – EXECUTE WITH RESULT SETS
https://www.itprotoday.com/sql-server-2012-t-sql-glance-execute-result-sets