November 4, 2015 at 12:30 pm
Hi there,
I have a question about how to change settings in SQL server. When I Right click on a Stored procedure and "Script Stored Procedure as" and then pick "Create Procedure" to a new query window.. I get this
USE [temp]
GO
/****** Object: StoredProcedure [dbo].[usp_BuildProc] Script Date: 11/04/2015 04:21:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_BuildProc]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE procedure [dbo].[usp_BuildProc]
as
if exists (select * from sysobjects where id = object_id(''dbo._Test'') and sysstat & 0xf = 3)
DROP TABLE _Test
Exec temp.dbo.usp_AddStats@recordcount=@@rowcount,@tablename=''Test2'',@SP_ProcessName=''usp_Build_STDData''
'
END
GO
I do not know why I see double quotes around ''dbo._Test''. Can anybody tell me why?
Thanks
November 4, 2015 at 1:01 pm
Because the whole command is being assigned to a variable and is quoted. You need to double-quote inside a quoted string to get a single-quote out
Gerald Britton, Pluralsight courses
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply