Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
silverkitten
Starting Member
5 Posts |
Posted - 2004-05-05 : 09:24:14
|
Hi all,I am trying to change 'Char' to 'Nchar' in a generated SQL script using the Query analyzer, but i can't simply do a 'Replace All' since it replaces 'varchar' with'varnchar' and 'character' with 'ncharacter'.And my database script is too big to be updated manually. Is there any other way this can be done??Its driving me crazy!! Please Help! |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-05-05 : 09:26:01
|
| yeah, put a space before char and Nchar... |
 |
|
|
silverkitten
Starting Member
5 Posts |
Posted - 2004-05-05 : 09:33:49
|
| I've done that, but i've got statements like CONVERT(char....and even some char's with two spaces before char or'+' or '[' |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-05-05 : 09:41:29
|
| So, if you know all the instances of character's you have before char, then do a few replaces... |
 |
|
|
silverkitten
Starting Member
5 Posts |
Posted - 2004-05-05 : 10:20:36
|
| actually, its a bit more complicated than that...i have to get a solution which does that automatically, coz this technique will be extended in other scripts as well..and i'm not sure if they'd like to do the replaces manually |
 |
|
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-05-06 : 14:48:41
|
| Make 3 passes. Change all varchar to ~~, then change Char to Nchar, then change ~~ back to varchar. |
 |
|
|
|
|
|