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 2005 Forums
 Transact-SQL (2005)
 Bitwise logic and dynamic sql

Author  Topic 

joerage
Starting Member

4 Posts

Posted - 2007-09-07 : 16:57:55
If I run the following statement
select 1 & 0 | 1
I get the result expected.

My problem is I have a string representation of the logic. I tried to evaluate it using dynamic sql, and it would not work. Here is the code I used:
declare @d nvarchar(10)
set @d = 'select 1 & 0 | 1'
EXEC sp_executesql @d

Any idea how to make this work?
Thanks,
Jonathan

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-09-07 : 17:11:24
Just change
declare @d nvarchar(10)

to
declare @d nvarchar(50)



Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-09-07 : 17:11:59
Try this:

declare @d nvarchar(16)
set @d = 'select 1 & 0 | 1'
EXEC sp_executesql @d
Go to Top of Page
   

- Advertisement -