Basic operations
Split long string to multiple lines (\ separator): SELECT ‘abc\ def’ AS [Result]; SELECT 0xabc\ def AS [Result];
Split long string to multiple lines (\ separator): SELECT ‘abc\ def’ AS [Result]; SELECT 0xabc\ def AS [Result];
Show advanced options: USE [master] GO EXEC [sys].[sp_configure] ‘Show advanced options’,1 GO RECONFIGURE WITH OVERRIDE GO
Update with the expression: UPDATE [dbo].[SampleTable] SET [Col1] = @a + @b + @c Update using the .WRITE() clause: UPDATE [dbo].[SampleTable] SET [Col1].WRITE(‘New Value, 0, NULL) UPDATE [dbo].[SampleTable] SET [Col1].WRITE(@a + @b + @c, 0, NULL) UPDATE [dbo].[SampleTable] SET [Col1].WRITE(@x, 500, 1000)
Check if SQLCMD mode is enabled in SSMS: :setvar __IsSqlCmdEnabled “True” GO IF N’$(__IsSqlCmdEnabled)’ NOT LIKE N’True’ BEGIN PRINT N’SQLCMD mode must be enabled to successfully execute this script.’; SET NOEXEC ON; END GO Declare database name as variable and switch database context: :SETVAR Database “MyDatabase” USE [$(Database)] GO Execute/Include…