This stored procedure lets you retrieve the environment variables from the server. you can pass in a partial name to get the variables that start with the partial match, or bblank to retrieve all the environment variables.
SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
/****** Object: Stored Procedure dbo.spEnvironVar Script Date: 12/18/2002 9:10:09 PM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spEnvironVar]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spEnvironVar]
CREATE PROCEDURE spEnvironVar(@VarName varchar(300) = '')
DECLARE @env nvarchar(4000)
SET NOCOUNT ON
SET @env = 'set ' + @VarName
CREATE TABLE #env (outputData varchar(8000))
INSERT INTO #env EXEC master..xp_cmdshell @env
SELECT CAST(LEFT(outputData, CHARINDEX('=', outputData) - 1) As varchar(75)) EnvName,
CAST(RIGHT(outputData, ABS(LEN(outputData) - CHARINDEX('=', outputData))) As varchar(4000)) As EnvValue
WHERE outputData IS NOT NULL
SET NOCOUNT OFF
DROP TABLE #env
SET QUOTED_IDENTIFIER OFF
SET ANSI_NULLS ON
GRANT EXECUTE ON [dbo].[spEnvironVar] TO [public]
I have always read that 8060 bytes is the maximum size. This is stated over and over again in Books Online, the MS site and numerous other sites, including this one. However a post in our forum recently questioned this. I decided to verify the problem and do a little research.
The User_Defined_Functions.exe file contains the User-Defined Functions white paper. The User-Defined functions white paper outlines the characteristics of the new user-defined function (UDF) feature that is introduced in Microsoft SQL Server 2000. The white paper also summarizes how you can create your own Transact-SQL functions to extend the programmability of Transact-SQL.
The following stored procedure will demonstrate the use of cursor metadata. Using cursor metadata we can get information about an SQL statement and use that information to dynamically generate other code such as HTML or other stored procedures.
ne of the issues you face when building Web applications is handling the errors you encounter when interacting with a back-end database. I was recently working with someone to create a new Web site with SQL Server™, ActiveX® Data Objects (ADO), and ASP. Lots of little things came up that I thought were worth sharing with MIND readers, so I'll focus this column on what I learned from this experience and the solutions to many of the problems I faced.