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 |
|
kidaduo
Starting Member
45 Posts |
Posted - 2008-05-05 : 10:48:19
|
| I have a sql proc. I need to make a parameter optional. I've setup the parameter to use a dataset as its source, and I need NOT to allow the value to be null. I've NOT selected allow nulls check box, But, when the parameter is null (‘’), still data comes back in a table as empty or if it is date will default to 1/1/1900. How do I send a null value to the database through sql proc and raise an error without inserting a null value? I’m hoping to avoid creating a special query just for that purpose. Thanks.Josephine |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-05 : 10:52:37
|
CREATE PROC...ASSET NOCOUNT ONIF @Param1 IS NULL BEGIN RAISERROR ( ' ... ', 16, 1) RETURNEND E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-05 : 10:53:25
|
Or, if you just want to convert to NULL value to another value.COALESCE(@Param1, GETDATE()) E 12°55'05.25"N 56°04'39.16" |
 |
|
|
kidaduo
Starting Member
45 Posts |
Posted - 2008-05-05 : 11:07:42
|
Thnak you Peso. I will try to use your suggestion. My server is down at a moment.Thkquote: Originally posted by Peso Or, if you just want to convert to NULL value to another value.COALESCE(@Param1, GETDATE()) E 12°55'05.25"N 56°04'39.16"
Josephine |
 |
|
|
|
|
|