Unix Technical Forum

Using NEWID() as a parameter to a stored procedure

This is a discussion on Using NEWID() as a parameter to a stored procedure within the SQL Server forums, part of the Microsoft SQL Server category; --> Is it possible to use NEWID() as a parameter to a stored procedure in SQL Server 2000. I keep ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 03:33 AM
A Rothberg
 
Posts: n/a
Default Using NEWID() as a parameter to a stored procedure

Is it possible to use NEWID() as a parameter to a stored procedure in
SQL Server 2000. I keep getting a "Line 1: Incorrect syntax near ')'"
error.

ALTER PROCEDURE dbo.StoredProcedure1
(
@x uniqueidentifier
)
AS
/* SET NOCOUNT ON */
RETURN


StoredProcedure1 NEWID()
go
"Line 1: Incorrect syntax near ')'"

Thanks in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 03:33 AM
Dan Guzman
 
Posts: n/a
Default Re: Using NEWID() as a parameter to a stored procedure

You need to pass the value as a variable or literal:

DECLARE @NewId uniqueidentifier
SET @NewId = NEWID()
EXEC StoredProcedure1 @NewId


--
Hope this helps.

Dan Guzman
SQL Server MVP

"A Rothberg" <arothberg@deloitte.com> wrote in message
news:ec40cda9.0407101858.4aa4f140@posting.google.c om...
> Is it possible to use NEWID() as a parameter to a stored procedure in
> SQL Server 2000. I keep getting a "Line 1: Incorrect syntax near ')'"
> error.
>
> ALTER PROCEDURE dbo.StoredProcedure1
> (
> @x uniqueidentifier
> )
> AS
> /* SET NOCOUNT ON */
> RETURN
>
>
> StoredProcedure1 NEWID()
> go
> "Line 1: Incorrect syntax near ')'"
>
> Thanks in advance



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:15 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com