Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set all fields to allow null

Status
Not open for further replies.

mattyboy2000

Programmer
Jul 31, 2002
129
GB
Hello,

I am creating a script to create a copy of a table then loop thorough an audit table and roll the changes back.

The problem I am facing is that some of the fields have been changed to not allow nulls. When I'm looping through the audit table and calling updates I am getting an error.

What I want to do is to automate changing all the fields in my new table (apart from the primary key) to allow nulls. I was going to use simple alter table statements, but because I need to know the data type if makes it a bit more complex.

Any ideas how to do this easily?

Thanks



Matt
 
If it's only 1 table, then know the datatypes. If it's many tables, then use the system tables to get the datatypes and accept the additional complexity.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top