How do I disable quoted identifiers when scripting out SQL Server database objects in Visual Studio?
I'm using Visual Studio 2005 to script out a database so that I can put it in subversion. Now one complaint that I have is that it puts my stored procedure code in a single literal string, like in the example. below.
/****** Object: StoredProcedure [dbo].[MyStoredProc] Script Date: 08/19/2010 16:40:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[MyStoredProc]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE [dbo].[MyStoredProc]
-- My T-SQL code here
END'
END
GO
I don'开发者_StackOverflow中文版t like this because then the syntax highlighting is useless. Is there anyway that I can turn this behaviour off, i.e. so that it removes this part?
EXEC dbo.sp_executesql @statement = N'
What is the motivation for doing it this way in the first place? String quoting has always been a topic that's somewhat of a blindspot of mine so I'm sure I'm not aware of all the implications. I might be more accepting of this behaviour if I understood what it is for.
SQL Server Management studio scripts out as Execute SQL if you select the option
Include If Not Exists
If you uncheck that the script is generated as you are looking for.
精彩评论