Print Page | Close Window

Using TRIM in SQL SP

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=4646
Printed Date: 30 March 2026 at 10:07am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Using TRIM in SQL SP
Posted By: Greaser
Subject: Using TRIM in SQL SP
Date Posted: 31 July 2003 at 10:36am

I think what I am needing to do is pretty easy I just cant figure out the right syntax and where to place it.  I need to pass a string to my stored procedure.  However it doesn't like characters like . / or :  .  But if I put them into square brackets it will work.  I am going from a form on an ASP page to SQL 2000 through a Stored procedure.  My Data Types are all  VarChar.  I am planning on using the TRIM function to add the [] and then to remove them in SQL unless there is an easier way.  Any help would be appreciated. Please let me know if you need more info. 

Exapmple:

strTime = Request.Form("uTime")

strTime = "[8:28:00]" if I hard code it with [ ] I don't get errors. 

strSQL  = "exec sp_insertStatus " + strType + ", " + StrBuildno + "," + strVer + ", " + strProc  + "," + strStatus + "," + strEta + "," + strTime + "," + strDate + ""

My stored procedure is

CREATE procedure sp_insertStatus
 @vType varchar(20),
 @VBuild varChar(20),
 @vVer varChar(20),
 @vProc varChar(5),
 @vStatus varchar (20),
 @vEta varchar(20),
 @vUtime varchar(20),
 @vUDate varchar(20)

as
declare @vBuildID varchar(9)
if EXISTS

 (
   Select * from tblBuild
 where type = @vtype and BuildNo = @vBuild and ver = @vVer and processor = @vProc
  )

    Begin
set @vBuildID = (Select pk_buildID from tblBuild where type = @vtype and BuildNo = @vBuild and ver = @vVer and processor = @vProc)

insert tblLabinfo
    values (@vBuildID, @vStatus, @vEta, @vUdate, @vUTime)
end

else
   begin
    insert into tblBuild values (@vType,@vBuild,@vVer,@vProc)

set @vBuildID = (Select pk_buildID from tblBuild where type = @vtype and BuildNo = @vBuild and ver = @vVer and processor = @vProc)

insert tblLabinfo
  values (@vBuildID, @vStatus, @vEta, @vUdate, @vUTime)

end
GO

 



-------------
'Computers don't make errors...what they do, they do on purpose.' - Dale Gribble



Replies:
Posted By: Greaser
Date Posted: 31 July 2003 at 11:29am

NEVER MIND! 

I just needed to add a nother single quote around the quotes.

'"+ strProc  + "'



-------------
'Computers don't make errors...what they do, they do on purpose.' - Dale Gribble



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net