Unix Technical Forum

Determining if a parameter exists in a stored procedure

This is a discussion on Determining if a parameter exists in a stored procedure within the SQL Server forums, part of the Microsoft SQL Server category; --> Hey, I'm writing some automated unit tests for a database app. The app creates a database via script. I'm ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 04:17 AM
Foehammer
 
Posts: n/a
Default Determining if a parameter exists in a stored procedure

Hey,
I'm writing some automated unit tests for a database app. The app
creates a database via script. I'm developing the system in a
test-driven manner and need a way to determine if a parameter exists
within a stored procedure using SQL. Any ideas?

Thanks,
Will
foehammer@hotmail.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 04:17 AM
John Bell
 
Posts: n/a
Default Re: Determining if a parameter exists in a stored procedure

Hi

It is not clear what you exactly want but the INFORMATION_SCHEMA.PARAMETERS
view may help?

John

"Foehammer" <foehammer@hotmail.com> wrote in message
news:27d68359.0406180542.236f0c45@posting.google.c om...
> Hey,
> I'm writing some automated unit tests for a database app. The app
> creates a database via script. I'm developing the system in a
> test-driven manner and need a way to determine if a parameter exists
> within a stored procedure using SQL. Any ideas?
>
> Thanks,
> Will
> foehammer@hotmail.com



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 04:17 AM
Foehammer
 
Posts: n/a
Default Re: Determining if a parameter exists in a stored procedure

I can test to see if a procedure exists as follows:

IF EXISTS ( SELECT * FROM dbo.sysobjects WHERE id =
object_id(N'[dbo].[PROCEDURENAME]')
AND OBJECTPROPERTY(id, N'IsProcedure') = 1)


If the select statement returns any records, then I know that the
procedure exists. What I need is a way to get the information
associated with a procedure parameter so I can do the same thing. Any
ideas?

Will
foehammer@hotmail.com

"John Bell" <jbellnewsposts@hotmail.com> wrote in message news:<8qDAc.3868$Ku4.34317443@news-text.cableinet.net>...
> Hi
>
> It is not clear what you exactly want but the INFORMATION_SCHEMA.PARAMETERS
> view may help?
>
> John
>
> "Foehammer" <foehammer@hotmail.com> wrote in message
> news:27d68359.0406180542.236f0c45@posting.google.c om...
> > Hey,
> > I'm writing some automated unit tests for a database app. The app
> > creates a database via script. I'm developing the system in a
> > test-driven manner and need a way to determine if a parameter exists
> > within a stored procedure using SQL. Any ideas?
> >
> > Thanks,
> > Will
> > foehammer@hotmail.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 04:17 AM
Foehammer
 
Posts: n/a
Default Re: Determining if a parameter exists in a stored procedure

Disregard my other post. That was exactly what I needed. Furthermore,
I can now fix a bunch of really hack-riddled code that I was using. I
had no idea whatsoever that those views were there (new to SQL
Server).

Thanks,
Will

"John Bell" <jbellnewsposts@hotmail.com> wrote in message news:<8qDAc.3868$Ku4.34317443@news-text.cableinet.net>...
> Hi
>
> It is not clear what you exactly want but the INFORMATION_SCHEMA.PARAMETERS
> view may help?
>
> John
>
> "Foehammer" <foehammer@hotmail.com> wrote in message
> news:27d68359.0406180542.236f0c45@posting.google.c om...
> > Hey,
> > I'm writing some automated unit tests for a database app. The app
> > creates a database via script. I'm developing the system in a
> > test-driven manner and need a way to determine if a parameter exists
> > within a stored procedure using SQL. Any ideas?
> >
> > Thanks,
> > Will
> > foehammer@hotmail.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:05 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com