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 |
|
divyagr
Starting Member
29 Posts |
Posted - 2009-03-24 : 06:14:36
|
| hi all , i am trying to convert .net code to sql... i got strucked in between like i want to check one passed parameter is intger or not if it an interger i have to give space after that parameter... if its a varchar i have to comma after that... i tried to do this with a stored procedure .Here i am pasting the stored procedure code along this ...i have commanded where we have to check the condn which i mentioned above.... i am using sql server 2005CREATE procedure [cus].[TEST]( @OrganisationName varchar(10), @BuildingNameNumber varchar(20), @SubBuildingNumber varchar(20), @StreetName varchar(50), @PostalTown varchar(20), @Locality varchar(50))asbegin Declare @legacyaddress varchar(100)set @legacyaddress='#'if @OrganisationName!=NULL or @OrganisationName!=''Begin @OrganisationName=@OrganisationName+''endif @BuildingNameNumber!=NULL or @BuildingNameNumber!=''Begin @BuildingNameNumber= @BuildingNameNumber+''endif @SubBuildingNumber!=NULL or @SubBuildingNumber!=''Begin -- how to check "Is the BuildingNameNumber a number?"is not done--here we have to check whether the "SubBuildingNumber " is integer or not @SubBuildingNumber= @SubBuildingNumber= @SubBuildingNumber+''endif @StreetName !=NULL or @StreetName !=''Begin @StreetName = @StreetName +''end print @legacyaddresswith regards,Divya |
|
|
darkdusky
Aged Yak Warrior
591 Posts |
|
|
divyagr
Starting Member
29 Posts |
Posted - 2009-03-24 : 06:42:24
|
| thank you Darkdusky... it got resolved for me.... the link u forward to me is really workedwith regards,Divya |
 |
|
|
darkdusky
Aged Yak Warrior
591 Posts |
Posted - 2009-03-24 : 06:58:40
|
| welcome |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-03-24 : 08:19:57
|
| General tip:do the validation on the frontend. Make sure the input parameters (and definitely the table columns) are the appropriate datatypes.Be One with the OptimizerTG |
 |
|
|
divyagr
Starting Member
29 Posts |
Posted - 2009-03-25 : 00:33:17
|
| k TG I will try like that....Thank youwith regards,Divya |
 |
|
|
|
|
|