SQL Server: How to SELECT vertically/ horizontally?
name maths science english sex aaa 11 22 33 female bbb 44 55 66 female ccc 77 88 99 female Use UNPIVOT [sql] select u.Test2, […]
name maths science english sex aaa 11 22 33 female bbb 44 55 66 female ccc 77 88 99 female Use UNPIVOT [sql] select u.Test2, […]
[sql]SELECT j.name FROM msdb.dbo.sysjobs AS j WHERE EXISTS ( SELECT 1 FROM msdb.dbo.sysjobsteps AS s WHERE s.job_id = j.job_id AND s.command LIKE ‘%store_proc_name%’ ); [/sql]
Because the query statement is too long, so the next added record may corrupt the query Because the reference table number is limited at 256 […]
Because that stored procedure is executed inside a stored procedure. Stored procedure executed inside a stored procedure is not hit by SQL profiler (?) Because that […]
Get the table structure by [sql]exec tempdb..sp_help ‘#tempTableName'[/sql]
Create trigger to log activities Record actions happening on CREATE/ALTER/DELETE stored proc Create table to save actions happening [sql] CREATE TABLE dbo.ProcedureChanges ( EventDate DATETIME […]
How to trace which stored procedures are called Open “Trace Properties” window Select “Event Selection” tab Check “Show all events”, “Show all columns” tab Check […]
INNER JOIN Return common records from 2 tables LEFT JOIN Return all records from LEFT table Return matching records from RIGHT table CROSS JOIN OUTER […]
How to INSERT data? How to insert by EXECUTE sql string? Example [sql] DECLARE @strSQL varchar(max) SET @strSQL = ‘SELECT * FROM <one_table>’ INSERT INTO […]
Ideas 1. Create a setting table having temporary import table name, format file name, stored proc name, upload folder name 2. Create Windows service to […]
Copyright © 2024 | WordPress Theme by MH Themes