Forum Posts

Last referers

Visitors Online

Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Database Projects in 2008 not scripting header comments of stored procedures anymore??

UserPost

1:07 pm
October 8, 2009


mlakarj

New Member

posts 2

1

I’ve noticed Database Projects in 2008 are not scripting header comments of stored procedures anymore. They’re being stripped out. Which is odd because it worked fine with 2005. This is frustrating because this is where we usually keep all stored proc modification history.  Can anyone please help?

3:53 pm
October 8, 2009


buckleyc

Member

posts 3

2

Do you mean VS 2008 database projects? SSMS 2008 Projects? That TFS thing that I cannot seem to remember the name of?


Sounds like a bug to me. What I would suggest creating the objects like this:

Create Procedure schema.name

@param1 datatype

AS

/*

comments here

*/

6:42 am
October 9, 2009


mlakarj

New Member

posts 2

3

VS 2008 DB Projects (”Data Dude”).  And guess what: it strips out comments between “AS” and “BEGIN” as well, any comment that isn't actually in the contents of the proc.  We can try to move all our headers to be within the contents of the proc (not really a “header” then, is it?), but that would be time consuming and tricky to do by hand or by script.

3:46 pm
October 9, 2009


buckleyc

Member

posts 3

4

Not as hard as you might think.


/*comments here*/

CREATE Procedure dbo.test

AS

BEGIN

       select 1

END

GO

 

DECLARE @Definition varchar(max)

DECLARE @comments varchar(max)

DECLARE @ProcTop varchar(max)

DECLARE @ProcBottom varchar(max)

 

DECLARE @StartComment int

DECLARE @EndComment int

DECLARE @StartProc int

SELECT @Definition=OBJECT_DEFINITION(OBJECT_ID('dbo.Test'))

 

SET @StartComment = CHARINDEX('/*',@Definition)

SET @EndComment = CHARINDEX('*/',@Definition)

SET @StartProc = CHARINDEX('BEGIN',@Definition)

SET @comments = SUBSTRING(@Definition,@StartComment,@EndComment+1)

SET @ProcTop = SUBSTRING(@Definition,@EndComment+2,@StartProc-@EndComment)

SET @ProcBottom = SUBSTRING(@Definition,@StartProc+5,LEN(@Definition))

 

PRINT @ProcTop + (CHAR(13)+CHAR(10)) + @Comments + @ProcBottom

Just loop your objects and do dynamic sql. You'll want to replace Create Procedure with Alter Procedure.

9:47 am
October 19, 2009


SQLGeek

New Member

posts 2

5

I also think this is a bug. This is affecting me as well as I am now adding all of our intranet databases to TFS. What's the point of having a header policy if VS just strips it out!

I am trying to find a way around this with no luck so far. Cliff's solution will work but it seems like overkill for something that should be supported.

10:16 am
October 19, 2009


SQLGeek

New Member

posts 2

6

So while doing some research I came across this. Not exactly what I wanted to see….

http://social.msdn.microsoft.c…..44961aa91b

Search 

About the SQL Slayer forum

Most Users Ever Online:

4


Currently Online:

2 Guests

Forum Stats:

Groups: 3

Forums: 3

Topics: 2

Posts: 9

Membership:

There are 19 Members

There has been 1 Guest

There is 1 Admin

There are 0 Moderators

Top Posters:

buckleyc – 3

mlakarj – 2

SQLGeek – 2

ostinoh – 1

admin – 0

bagatonovic – 0

Administrators: abean (1 Post)




Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • email
  • LinkedIn