Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change SQL column from numeric(3,0) to numeric(6,0)
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01685524
Message ID:
01685540
Views:
25
>>Hi,
>>
>>I am trying to write a code (in a .prg) that would change a SQL Server column size from numeric(3,0) to numeric(6,0). But I can't.
>>Anyone can suggest a code to make such a column size change?
>>
>>TIA
>
>What is wrong with integer?
>As Tore said int is better than numeric(6,0)
>Pure TSQL command:
>
>IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE Table_NAME = 'YourTableName'
>                                                     AND Column_Name = 'ColumnName'
>                                                     AND Data_Type = 'int')
>   BEGIN
>      ALTER TABLE YoutTable ALTER COLUMN YourColumn int
>   END
>
>Keep in mind that if you have some constraints with this column you should remove them first and set them back again.

I am wondering if ALTER TABLE (in code) on a table with about 1 million records may take a long time or even time out. Also, as I already wrote to Tore, I need to make sure that nowhere the code will break because it depends on NUMERIC() type.
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform