General discussion

Locked

Processing parameters in TransAct SQL

By dmitryzb. ·
Here's my problem:

select *
from #my_vars
where sec_type in (select @new_type)

Variable @new_type contains different values (Ex. string1, string2, or "string1","string2") to match one or the other or both. When the var contains string1 or string2, it works. When it contains the combo (this is how I assign the value)

select @new_type = '"string1","string2"'

it doesn't work.

If I hard code the combo in the where clause, like this:

where sec_type in ("string1","string2")

it works.

Maybe it's the version of Sybase that I'm running?..

Thank you,
- Dmitry

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Processing parameters in TransAct SQL

by agibbs In reply to Processing parameters in ...

I've never used Sybase, but in MS SQL (and according the T-SQL standard) that just won't work the way you're doing it . . .

You'll have to store the values for @new_type in a table, and use a statement more like this:

SELECT * FROM #my_vars
WHERE sec_type IN (SELECT new_type FROM table_1)

Best,
Aaron

Collapse -

Processing parameters in TransAct SQL

by dmitryzb. In reply to Processing parameters in ...

Aaron,

Thank you for your help. That's actually what I had in mind, but was hoping I didn't have to do that.

Sorry for the delay, I was just waiting to see if I get any other responses. Thanks again,

- Dmitry

Collapse -

Processing parameters in TransAct SQL

by dmitryzb. In reply to Processing parameters in ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums