July 23, 2008 at 4:28 am
Hi All,
I have to redesign a database.In doing so I have to decrease the column length for char and varchar datatypes with out loosing the existing data.I created a new table with the correct column length.But as I import data into the new table am getting an error that data will be lost. please suggest a solution
regards,
Ahmad
Regards,
[font="Verdana"]Sqlfrenzy[/font]
July 23, 2008 at 7:19 am
Can you provide the table layout and a sample of the data that you're trying to insert? That'll help to reply with a more accurate answer to your issue.
-- You can't be late until you show up.
July 24, 2008 at 4:10 am
helloo....plz chk out da attachements.... 🙂
Regards,
[font="Verdana"]Sqlfrenzy[/font]
July 24, 2008 at 7:22 am
If it were me, I would:
select max(len([columnName])) from [tableName]
for each column I was planning on modifying and compare that result against the length you want to change it to. For example, if your select max(len()) returns a 55 and you want to change it to a length of 50, then you will lose data. You can either truncate the data yourself or let SQL do it as it is changing the column type.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply