August 1, 2006 at 3:01 pm
Hello
I read a script to create a function to return the SQL version :
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[fnGetSQLBuild]') AND xtype in (N'FN', N'IF', N'TF'))
DROP FUNCTION [dbo].[fnGetSQLBuild]
GO
CREATE FUNCTION [dbo].[fnGetSQLBuild] () RETURNS nvarchar(20) AS
BEGIN
RETURN SUBSTRING(@@VERSION, CHARINDEX( N' - ', @@VERSION)+3, CHARINDEX(N' (', @@VERSION) - (CHARINDEX( N' - ', @@VERSION)+3))
END
Now, how can i run this function to show the result on grid in query analyser.
Many thanks
Luis Santos
August 1, 2006 at 3:36 pm
Make sure you grant permissions on your function first.
declare @SQLBuild nvarchar(20)
set @SQLBuild = dbo.fnGetSQLBuild()
print @SQLBuild
August 1, 2006 at 3:53 pm
... or just:
select dbo.fnGetSQLBuild()
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply