dbTalk Databases Forums  

DTS: SQL Syntax Error

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS: SQL Syntax Error in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Steve
 
Posts: n/a

Default DTS: SQL Syntax Error - 10-21-2004 , 11:23 AM






Hi,

I have created automated partitoned tables. When the DTS package runs a
table is created automtaically with week# as extension.
For example customers43 this week. And next week when the package runs
customers44 is created. Now I want to insert the data in the partiotned table
weekly.
I am using following syntax to Bulk insert the data in the newly created
table(Using execute SQL task to do this). But I am getting error.


declare @a varchar(25)

select @a = name from sysobjects where name like 'customers%'
and crdate > getdate() - .5

BULK INSERT Costco_Demo..@a FROM 'C:\FolderA\cust.txt'

Can someone please fix the syntax.


Thanks

Steve

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: SQL Syntax Error - 10-21-2004 , 03:28 PM






You will need to build the whole statement dynamically and then execute it.

You could also set the DestinationObjectName property of the DataPump task
to be your new table as all the attributes will be the same right?

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Steve" <Steve (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,

I have created automated partitoned tables. When the DTS package runs a
table is created automtaically with week# as extension.
For example customers43 this week. And next week when the package runs
customers44 is created. Now I want to insert the data in the partiotned
table
weekly.
I am using following syntax to Bulk insert the data in the newly created
table(Using execute SQL task to do this). But I am getting error.


declare @a varchar(25)

select @a = name from sysobjects where name like 'customers%'
and crdate > getdate() - .5

BULK INSERT Costco_Demo..@a FROM 'C:\FolderA\cust.txt'

Can someone please fix the syntax.


Thanks

Steve



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.