PDA

View Full Version : Solved: SP_HELP



Andy McW
04-08-2009, 01:57 PM
Hi guys, first time post here. Hope someone can help with the below question.

I am an analyst in financial services using MS SQL Server and therefore not a database designer or administrator.

I am querying a table which contains a column with a constraint of 1 or 0 which flags whether a row is active or closed. There must be a rule that decides which flag to use however I cannot find it.

I can use SP_HELPTEXT on a View to get the SQL statement that created it, but it does not seem to work on the table. The database is an old one, but kept in use for some old reports. The person that created the database and tables has long gone and nobody seems to be able to help.

Is there a way to get to this information?

Thanks and Regards

Andy

Mavyak
04-08-2009, 02:42 PM
Check for Triggers on the table. If it's not there, it may be defined as a default value. If so, you can view the default value by right-clicking on the table and selecting "Design." Then click on the column name and check the properties. The default value should be displayed there.

Hope that helps,

Mav

Andy McW
04-09-2009, 12:22 PM
Mav, Thanks for taking the time to post a reply.

Back in the office this afternoon I tried your suggestions but could not understand or work out what you meant.

I did find a solution however. The table in question is created following an overnight transfer of data from several systems, and after digging around some of the databases, I found a ton of stored procedures. One of these contained the syntax for creating the table.

Not sure how to mark the thread as solved. - NOW FOUND.

Cheers

Andy