Tuesday, November 19, 2013

Passing a List as a SQL Parameter

Take a simple query something like this:




select * from Orders
where OrderID in (1724, 1722, 1710)
order by OrderID desc



In the course of using this query, we might try input it's values as parameters. 




select * from Orders
where OrderID in (@ord1, @ord2, @ord3)
order by OrderID desc



But we don't always know how  many of them there are.  For this case we need what is called a table valued parameter - or a list parameter.









...




Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Friday, November 1, 2013

SQL Server: Resync Users to Logins after Restore









...




Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

How to Auto-generate Order Line Item numbers for bulk uploads

 I had a problem where I had 17000 line items to insert into 9000 orders. The system required line item numbers, preferably numbered 1throug...