My Work
My Blogs
Hotlinks
Category Archives: tsql
An aggregate may not appear in the set list of an UPDATE statement
Ever seen the error “An aggregate may not appear in the set list of an UPDATE statement” when working with SQL Server? I ran into this one recently after trying to put a COUNT in an UPDATE statement. I was rewriting … Continue reading
Posted in database, development, internets, microsoft, SQL, tips and tricks, tsql
Leave a comment
Use sys.dm_exec_sessions to disconnect SQL user connections
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 — init vars DECLARE … Continue reading
2 of 10,388 days remaining #TRON
– Using tsql to figure out how long until TRON:LEGACY DECLARE @tron datetime, @tron_legacy datetime SET @tron = ’7/9/1982 12:00:00′ SET @tron_legacy = ’12/17/2010 12:00:00′ SELECT CAST( DATEDIFF( DD, GETDATE(), @tron_legacy ) as varchar(2) ) + ‘ of’ + CAST … Continue reading
Posted in fun, internets, microsoft, motivation, SQL, tsql
Leave a comment
TSQL : How to find all database tables ending with an UPPERCASE X
1 2 3 4 5 6 7 8 9 10 — Give me all tables ending with an UPPERCASE X SELECT table_name, SUBSTRING( table_name, LEN(table_name), 1 ) as 'end' FROM INFORMATION_SCHEMA.TABLES — SELECT ascii('X') = 88 — SELECT ascii('x') = … Continue reading
Posted in database, internets, SQL, tips and tricks, tsql
Leave a comment
