Scripting stored procs into a data project is useless for me now.
This is really frustrating. I used to ba able to script stored procs from the server explorer into a data project. It would create a single file for each proc and would look something like this:
IF EXISTS
(SELECT * FROM sysobjects WHERE type = 'P' AND name = 'Stored_Procedure_Name')BEGIN
DROP Procedure Stored_Procedure_Name
END
GO
CREATE Procedure
Stored_Procedure_NameAS
...
GO
This was great. I could check the scripts into source control. I could use VS.NET to maintain the procs and just right click and select "run on" to deploy it to the sql instance. This seems to have taken a turn for the worse in 2005. All I can get it to create now is this:
/****** Object:
StoredProcedure [dbo].[Stored_Procedure_Name] Script Date: 04/23/2006 10:55:50 ******/IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Stored_Procedure_Name]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[Stored_Procedure_Name]
GO
/****** Object: StoredProcedure [dbo].[Stored_Procedure_Name] Script Date: 04/23/2006 10:55:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Stored_Procedure_Name]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE Procedure dbo.Stored_Procedure_Name
AS
/*
Code goes here
*/
'
END
GO
Wow. this is totally useless for my purposes. Wy does it generate a dynamic sql with an exec? What the heck? I guess your supposed to code all your procs on the db server and then go back at some point and rescript them out and put them into source control. Hopefully there is some way to customize the script template that its using.
I know this isnt a problem if you create a data project from the beginning and just add strored procedure scripts as you go. What about those people that already have a mass of procs in their db server that they want to migrate to a dataproject for source control purposes?
I know I'm just missing something obvious. I can't wait until I can just slap my forhead and move on.