none
Run Same SQL Update & SQL Select Statement on about 6 Different Tables

    Question

  • I have 6 tables that I need to 1st run an update statement on, then a select statement on.  Currently my code has been -- is there a way to reduce the code and speed this up?

    Update Ice.dbo.ReyjavikStore Set MangerCheck = 'Yes', ManagerCheckDate = GetDate() WHERE ManagerCheck IS NULL AND supervisorCheck IS NOT NULL --then of course there would be subsequent table names below Create table #NeedsManagerReview ( ID int, salesManName varchar(100), ItemSold varchar(100), quantity int, SaleTotal int, StoreName varchar(100) ) Insert into #NeedsManagerReview(ID, salesManName, ItemSold, quantity, SaleTotal, StoreName) SELECT salesManName, ItemSold, Quantity, SaleTotal, Storename FROM Ice.dbo.ReyjavikStore

    Where managerReview IS NOT NULL --Then of course subsequent Insert into statements --Once all Update & Select statements have been Run Select * from #NeedsManagerReview Drop Table #NeedsManagerReview



    • Edited by IndigoMontoya Friday, November 15, 2013 9:51 PM error in Select Statement
    Friday, November 15, 2013 9:40 PM

Answers