SQL: How to use “order by” with “select distinct”?
A query with SELECT DISTINCT can be rewritten using GROUP BY. So this [sql] SELECT DISTINCT city FROM HR.Employees WHERE country = N’USA’ AND region […]
A query with SELECT DISTINCT can be rewritten using GROUP BY. So this [sql] SELECT DISTINCT city FROM HR.Employees WHERE country = N’USA’ AND region […]
Convert varchar to decimal error 1 Add another column with required dataType. [sql] ALTER TABLE [table name] ADD [column name] decimal(10,2) NULL [/sql] Import all […]
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 […]
Copyright © 2024 | WordPress Theme by MH Themes