|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, April 30, 2010 11:01 AM
Points: 1,
Visits: 13
|
|
Hi!!!
The variable is initialized in a stored procedure with the value present in a table. It is disappearing at later point of time.The data type of variable is Char. Tried to print the value, it displays as NULL. Please help me...
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 3:33 PM
Points: 11,648,
Visits: 27,768
|
|
chaturvedi.garima (4/30/2010)
Hi!!! The variable is initialized in a stored procedure with the value present in a table. It is disappearing at later point of time.The data type of variable is Char. Tried to print the value, it displays as NULL.  Please help me...
so....are you going to show us the stored procedure? can't really help without that; there must be something changing the data if you say it was initialized to some value, or it was not assigned a value from your table when ou thought it was.
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 4:52 PM
Points: 1,379,
Visits: 2,626
|
|
chaturvedi.garima (4/30/2010)
Hi!!! The variable is initialized in a stored procedure with the value present in a table. It is disappearing at later point of time.The data type of variable is Char. Tried to print the value, it displays as NULL.  Please help me...
I second the part of needing to see the code. If there are lots of lines in the code you may need to Keep trying to put print statements in various spots to see what the value is to try by process of elimination find where you're assigning NULL to it.
--------------------------------------------------------------------- Use Full Links: KB Article from Microsoft on how to ask a question on a Forum
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Tuesday, June 19, 2012 9:31 AM
Points: 421,
Visits: 78
|
|
Is it possible that the statement retrieving the value from the table does not actually return a row..? This would make the variable NULL.
As the other posts have said, we are happy to help if you post your code.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 2:29 PM
Points: 827,
Visits: 5,713
|
|
Just a shot in the dark without being able to see the code, but if you're using the variable in any concatenation operation, you might want to set the CONCAT_NULL_YIELDS_NULL option off and try it again. With the option on, any concatenation with a NULL will change the entire string to NULL.
And then again, I might be wrong ... David Webb
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, September 19, 2012 8:39 AM
Points: 595,
Visits: 1,226
|
|
Just FYI, CONCAT_NULL_YIELDS_NULL will always be on in future versions of SQL Server.
Converting oxygen into carbon dioxide, since 1955.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 6:25 PM
Points: 32,930,
Visits: 26,819
|
|
David Webb-200187 (4/30/2010) Just a shot in the dark without being able to see the code, but if you're using the variable in any concatenation operation, you might want to set the CONCAT_NULL_YIELDS_NULL option off and try it again. With the option on, any concatenation with a NULL will change the entire string to NULL.
Oh... absolutely correct but I wouldn't do it that way especially since it's already known that future versions of SQL Server will not have the option of turning it off. Better to use ISNULL() for such things.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|