Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 8th, 2007, 11:37 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting variable to user defined type

I'm trying to run the following, but keep getting error message
'Incorrect Syntax near keyword DECLARE'

CREATE Function dbo.fnGetEndDate()
Returns EndDate /*This is a UDT*/
AS
DECLARE @GetEndDate as EndDate
BEGIN
Set @GetEndDate=CAST(frmLauncher.Evaluation_ID AS varchar(20))
RETURN @GetEndDate
END


 
Old August 8th, 2007, 01:53 PM
Friend of Wrox
 
Join Date: Feb 2006
Location: noida, UP, India.
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gaurav_jain2403
Default

Try this and tell if it works:

CREATE Function dbo.fnGetEndDate()
Returns EndDate /*This is a UDT*/
AS
BEGIN
DECLARE @GetEndDate EndDate
Set @GetEndDate=(Select CAST(frmLauncher.Evaluation_ID AS varchar(20)) from TableName)
RETURN @GetEndDate
END
 
Old August 10th, 2007, 02:51 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes Guarav,
That worked beautifully, thank you. I'm still in my VBA mindset.

THANKS!!

 
Old August 10th, 2007, 03:52 AM
Friend of Wrox
 
Join Date: Feb 2006
Location: noida, UP, India.
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gaurav_jain2403
Default

You are most welcome.

Cheers!!!!




Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Connection user-defined type not defined Wall st Guru Excel VBA 2 March 26th, 2014 03:44 PM
User-defined type as input for store procedures davidb BOOK: Professional Java Development with the Spring Framework 0 August 11th, 2005 02:49 PM
User-defined type not defined (Icecream.mdb) dloren01 BOOK: Beginning Access VBA 0 June 22nd, 2005 10:36 PM
Using a user defined type and the Split Function nikotromus Access VBA 2 August 20th, 2004 12:02 PM
Table and User Defined Type with same Name djuricd SQL Server 2000 3 April 20th, 2004 12:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.