Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Converting Excel worksheet to recordsets problems

Author  Topic 

biffysix
Starting Member

5 Posts

Posted - 2002-05-15 : 21:12:58
Hi fellow SQL'ers

I have inputted all the records from an excel worksheet of products (rows) with their respected costs and formulas.
After an afternoon of inputting I found out it takes too long to go into every record and change the month from May to June.

I think I need a script(batch) that runs and takes all the May records and inserts it as a June record. Is this possible or is there a better way? So far I have the user just change the months and insert the record but it takes too long for all the May records.

Just need some pointers to get started.
Thanks
BW



graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2002-05-15 : 21:17:12
How about something like this:

Insert MyTable (TranMonth, Cost, Formula)
Select TranMonth = 'June',
Cost,
Formula
From MyTable
Where TranMonth = 'May'


Of course this assumes we're in SQL Server and not in Excel.



===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

biffysix
Starting Member

5 Posts

Posted - 2002-05-16 : 21:07:30
Thanks,

Also, would it be possible to schedule the script to run at the first of every month?

Go to Top of Page

dataphile
Yak Posting Veteran

71 Posts

Posted - 2002-05-17 : 06:09:32
Use data transformation services and create a new package.
Just drop a sql server connection and a sql task on the whitespace.
Save the package and rightclick on it to schedule. Make sure it is enabled.

Schedule a couple of arbitrary package 1 min into the future to make sure that you've got it right.

Go to Top of Page

biffysix
Starting Member

5 Posts

Posted - 2002-05-20 : 05:19:32
Thanks,
I'll try it out!




Go to Top of Page
   

- Advertisement -