dbTalk Databases Forums  

DTS Lokup %

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


Discuss DTS Lokup % in the microsoft.public.sqlserver.dts forum.



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

Default DTS Lokup % - 07-19-2004 , 11:56 PM






Hi,

In DTS Lookup, I want to write a query as

SELECT col1
FROM Table1
WHERE col2 like '%0001' ( this would be parameter) this returns one row.

col2 is varchar column

I wrote it as

SELECT col1
FROM Table1
WHERE col2 like ?

But it doesnt seems to work.

Any idea what should be the value of parameter. I tried passing value as '%0001', '0001', %0001, but no luck... i.e. it doesnt return any row.

Any help would be appreciated..

Regards,
Nilay.


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

Default Re: DTS Lokup % - 07-20-2004 , 02:17 AM






You can adapt this example from QA

declare @au_fname varchar(30)
set @au_fname = 'ean'

select * from Authors where au_fname like '%' + @au_fname


I just plugged this into an ExecuteSQL task and it works

select * from authors where
au_fname like '%' + ?



--

----------------------------

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


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

Quote:
Hi,

In DTS Lookup, I want to write a query as

SELECT col1
FROM Table1
WHERE col2 like '%0001' ( this would be parameter) this returns one row.

col2 is varchar column

I wrote it as

SELECT col1
FROM Table1
WHERE col2 like ?

But it doesnt seems to work.

Any idea what should be the value of parameter. I tried passing value as
'%0001', '0001', %0001, but no luck... i.e. it doesnt return any row.

Any help would be appreciated..

Regards,
Nilay.




Reply With Quote
  #3  
Old   
Nilay Shah
 
Posts: n/a

Default Re: DTS Lokup % - 07-20-2004 , 03:13 AM



It works in ExecuteSQL task but it doesnt work in Data Transformation Lookup.. I need specifically in lookup because while transformation I have to find corresponding value..

"Allan Mitchell" wrote:

Quote:
You can adapt this example from QA

declare @au_fname varchar(30)
set @au_fname = 'ean'

select * from Authors where au_fname like '%' + @au_fname


I just plugged this into an ExecuteSQL task and it works

select * from authors where
au_fname like '%' + ?



--

----------------------------

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


"Nilay Shah" <Nilay Shah (AT) discussions (DOT) microsoft.com> wrote in message
news:52FF5319-A061-4A77-8BD4-E9A6623B9296 (AT) microsoft (DOT) com...
Hi,

In DTS Lookup, I want to write a query as

SELECT col1
FROM Table1
WHERE col2 like '%0001' ( this would be parameter) this returns one row.

col2 is varchar column

I wrote it as

SELECT col1
FROM Table1
WHERE col2 like ?

But it doesnt seems to work.

Any idea what should be the value of parameter. I tried passing value as
'%0001', '0001', %0001, but no luck... i.e. it doesnt return any row.

Any help would be appreciated..

Regards,
Nilay.





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

Default Re: DTS Lokup % - 07-20-2004 , 03:44 AM



Works for me

In my package I am transferring Pubs:authors to a text file

In my transformations I have



dim val

val = DTSLookups("lkp").Execute("ean")

msgbox val


DTSDestination("au_id") = DTSSource("au_id")
DTSDestination("au_lname") = DTSSource("au_lname")
DTSDestination("au_fname") = DTSSource("au_fname")
DTSDestination("phone") = DTSSource("phone")
DTSDestination("address") = DTSSource("address")
DTSDestination("city") = DTSSource("city")
DTSDestination("state") = DTSSource("state")
DTSDestination("zip") = DTSSource("zip")
DTSDestination("contract") = DTSSource("contract")
DTSDestination("XXX") = DTSSource("XXX")
DTSDestination("rowguid") = DTSSource("rowguid")
Main = DTSTransformStat_OK


My Lookup Query looks like this

SELECT au_id
FROM authors
WHERE (au_fname LIKE '%' + ?)





--

----------------------------

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


"Nilay Shah" <NilayShah (AT) discussions (DOT) microsoft.com> wrote

Quote:
It works in ExecuteSQL task but it doesnt work in Data Transformation
Lookup.. I need specifically in lookup because while transformation I have
to find corresponding value..
Quote:
"Allan Mitchell" wrote:

You can adapt this example from QA

declare @au_fname varchar(30)
set @au_fname = 'ean'

select * from Authors where au_fname like '%' + @au_fname


I just plugged this into an ExecuteSQL task and it works

select * from authors where
au_fname like '%' + ?



--

----------------------------

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


"Nilay Shah" <Nilay Shah (AT) discussions (DOT) microsoft.com> wrote in message
news:52FF5319-A061-4A77-8BD4-E9A6623B9296 (AT) microsoft (DOT) com...
Hi,

In DTS Lookup, I want to write a query as

SELECT col1
FROM Table1
WHERE col2 like '%0001' ( this would be parameter) this returns one
row.

col2 is varchar column

I wrote it as

SELECT col1
FROM Table1
WHERE col2 like ?

But it doesnt seems to work.

Any idea what should be the value of parameter. I tried passing value
as
'%0001', '0001', %0001, but no luck... i.e. it doesnt return any row.

Any help would be appreciated..

Regards,
Nilay.







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.