Instantly share code, notes, and snippets.

Alex White alexdwhite

View GitHub Profile
View Sample SQL Update with Join statement
a.Field1 = b.Field1,
a.Field2 = b.Field2
from tableA a
inner join tableB b on a.fKey = b.pKey
where a.pKey = @someValue
View SQLTempTableLoop
-- This can be performed numerous ways, and can also be performed more efficiently, but I broke out the
-- sections so that they are easy to identify and understand
-- create temp table
declare @tbl table (id int identity, valueA int)
-- used for the loop
declare @ptr int, @max int, @valueA int
-- insert list of ID's into temp table