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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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 |
| |||
| 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 |
| ||||
| 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 |