![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
hello, I'd like to use a global variable in the source sql-query of a data driven query task. I simply use a ? for the parameter. My database connection is a Microsoft OLE DB provider for sql-server. The problem is that he doesn't accept this syntax, he gives a syntax-error and when I remove the question mark it works. Unfortunately I don't have any inspiration how I should resolve this. It must be posible to access a global variable from within this query I suppose. Anyone an idea ? Tnx in advance, Koen |
#3
| |||
| |||
|
|
Which version of SQL Server? What is the syntax you are using? -- -- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Koen Appeltans" <koen (AT) sdt-informatics (DOT) be> wrote in message news:ca4734f1.0405100554.58415173 (AT) posting (DOT) google.com... hello, I'd like to use a global variable in the source sql-query of a data driven query task. I simply use a ? for the parameter. My database connection is a Microsoft OLE DB provider for sql-server. The problem is that he doesn't accept this syntax, he gives a syntax-error and when I remove the question mark it works. Unfortunately I don't have any inspiration how I should resolve this. It must be posible to access a global variable from within this query I suppose. Anyone an idea ? Tnx in advance, Koen |
#4
| |||
| |||
|
|
Hi, My version of sql-server is SQL-Server 2000. A part of the source query of the data driven query task is : declare @LaatsteSynchronisatie datetime -- begin instellen op lang geleden set @LaatsteSynchronisatie = '1978-01-01' select @LaatsteSynchronisatie = LaatsteSynchronisatie from dbo.Synchronisatie where VertegenwoordigerID = 1 The 1 should be replaced by a global variable : so I replaced it with a question mark, but when I do this he gives a Syntax error on the query, and I can't link the question mark to a global variable. I suppose that this normally should work ? Kind regards, Koen Appeltans "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote Which version of SQL Server? What is the syntax you are using? -- -- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Koen Appeltans" <koen (AT) sdt-informatics (DOT) be> wrote in message news:ca4734f1.0405100554.58415173 (AT) posting (DOT) google.com... hello, I'd like to use a global variable in the source sql-query of a data driven query task. I simply use a ? for the parameter. My database connection is a Microsoft OLE DB provider for sql-server. The problem is that he doesn't accept this syntax, he gives a syntax-error and when I remove the question mark it works. Unfortunately I don't have any inspiration how I should resolve this. It must be posible to access a global variable from within this query I suppose. Anyone an idea ? Tnx in advance, Koen |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Ok, i'll give an example for a query : let's say I want a list of customers for one salesman (every salesman has his onw list of customers) so the query is +- : select * from customers where salesmanID = ? and the salesmanID is a global variable of the package. But I'm particullary wondering why I can't make use of parameters in this context (source query). Kind regards, Koen Appeltans *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Yes I'm using SQL-Server 2000. When I hit or the 'parameters'-button or the 'parse query'-button he gives a messagebox : package error Error source : Microsoft OLE DB provider for SQL Server Error description : Syntax error. , when there's a question mark in the query. When there's no question mark in the query, the query is accepted. Koen *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#9
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |