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.
| Author |
Topic |
|
Cattrah
Starting Member
13 Posts |
Posted - 2008-06-05 : 14:28:04
|
| this is not making a whole lot of sense to me. I am trying to do this very simple query:SELECT ID FROM Equipment WHERE CMMS_ID=@EqNum This is inside a cursor where I select from an oracle datasource. @EqNum is declared as an nvarchar(15), after selecting into it from the cursor I print the variable and it reads:000000000015552perfect. But when it executes against the above query I get no results. However, if I execute the following query manuallySELECT ID FROM Equipment WHERE CMMS_ID='000000000015552' it returns results. Aren't these supposed to be exactly the same??? Why am I not getting results when I use the variable? Also CMMS_ID column is an nvarchar(15) column.Is this weird or what? Is oracle really returning something different than is what is printing?? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-06-05 : 14:31:01
|
| What you have posted will work in SQL Server without any problems. Perhaps you should post your entire code, although we might have a hard time help answering a question about Oracle here.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-05 : 14:35:25
|
| There is a chance that you might have space or some unprintable characters within your string param. That might be a reason why = operator does nor evaluate it to true. |
 |
|
|
Cattrah
Starting Member
13 Posts |
Posted - 2008-06-05 : 14:44:11
|
| I figured it out, there's nothing wrong with the code, in one case I was just using the wrong variable to begin with and in the other case (that I didn't show because I thought it was the same problem) I forgot I ran an earlier insert query using an int variable not a varchar so '000000000015552' <> '15552'Someone really should warn people how stupid being pregnant makes you.Thanks anyway! |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-06-05 : 15:12:34
|
quote: Originally posted by Cattrah Someone really should warn people how stupid being pregnant makes you.
I hear ya on that!Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
|
|
|