March 1, 2012 at 8:06 am
aurato (3/1/2012)
GilaMonster (3/1/2012)
aurato (3/1/2012)
GilaMonster (3/1/2012)
Chance the #StatusHistory temp table not the permanent table. You'll need to drop all indexes and constraints on that column first, change the data type and then recreate the indexes and constraintsThis makes more sense I guess. I do eventually want to change the source table because I'm sure this join happens in lots of other queries (both very heavily used tables around here).
No point in doubling the storage size unnecessarily. If that column is 17-20 ASCII characters, then changing it to nvarchar wastes up to 20 bytes per row. On a 3 million row table that's 57MB of wasted space in the table and in index that the column appears in.
Rather make sure that any table joining to it is char/varchar of an appropriate length
Did I mistype somewhere? I actually want it to go from unicode to non-unicode.
EDIT: In this case nvarchar(50) to varchar(21), as in GP the SOPNUMBE is a char(21)
You said you eventually want to change the source table (which I assume is SOP30300), and that's already a char(21)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 1, 2012 at 8:07 am
GilaMonster (3/1/2012)
aurato (3/1/2012)
GilaMonster (3/1/2012)
aurato (3/1/2012)
GilaMonster (3/1/2012)
Chance the #StatusHistory temp table not the permanent table. You'll need to drop all indexes and constraints on that column first, change the data type and then recreate the indexes and constraintsThis makes more sense I guess. I do eventually want to change the source table because I'm sure this join happens in lots of other queries (both very heavily used tables around here).
No point in doubling the storage size unnecessarily. If that column is 17-20 ASCII characters, then changing it to nvarchar wastes up to 20 bytes per row. On a 3 million row table that's 57MB of wasted space in the table and in index that the column appears in.
Rather make sure that any table joining to it is char/varchar of an appropriate length
Did I mistype somewhere? I actually want it to go from unicode to non-unicode.
EDIT: In this case nvarchar(50) to varchar(21), as in GP the SOPNUMBE is a char(21)
You said you eventually want to change the source table (which I assume is SOP30300), and that's already a char(21)
Oh I'm sorry I meant the source table that I populate #StatusHistory with which is called PLCTrack_StatusHistory.
March 1, 2012 at 10:03 am
Umm... Unless I missed something, you are trying to change the data type on a production table that is accessed by Great Plains? I'm not so sure it is a good idea to change a data type on a GP table. GP, in my experience, is extremely finicky. You change something on the database and you could be in for a world of hurt.
Jared
CE - Microsoft
March 1, 2012 at 11:09 am
SQLKnowItAll (3/1/2012)
Umm... Unless I missed something, you are trying to change the data type on a production table that is accessed by Great Plains? I'm not so sure it is a good idea to change a data type on a GP table. GP, in my experience, is extremely finicky. You change something on the database and you could be in for a world of hurt.
Yeah read my last post I didn't mean to give that impression. I'm not gonna touch Great Plains. There is a third, unmentioned table in the original post that supplies the sopnumbes for my temp table. I meant that I wanted to change THAT column to match the GP one.
March 1, 2012 at 11:28 am
aurato (3/1/2012)
SQLKnowItAll (3/1/2012)
Umm... Unless I missed something, you are trying to change the data type on a production table that is accessed by Great Plains? I'm not so sure it is a good idea to change a data type on a GP table. GP, in my experience, is extremely finicky. You change something on the database and you could be in for a world of hurt.Yeah read my last post I didn't mean to give that impression. I'm not gonna touch Great Plains. There is a third, unmentioned table in the original post that supplies the sopnumbes for my temp table. I meant that I wanted to change THAT column to match the GP one.
So you don't need to ALTER anything... Just change your definition or SELECT ... INTO
Jared
CE - Microsoft
March 1, 2012 at 12:13 pm
SQLKnowItAll (3/1/2012)
aurato (3/1/2012)
SQLKnowItAll (3/1/2012)
Umm... Unless I missed something, you are trying to change the data type on a production table that is accessed by Great Plains? I'm not so sure it is a good idea to change a data type on a GP table. GP, in my experience, is extremely finicky. You change something on the database and you could be in for a world of hurt.Yeah read my last post I didn't mean to give that impression. I'm not gonna touch Great Plains. There is a third, unmentioned table in the original post that supplies the sopnumbes for my temp table. I meant that I wanted to change THAT column to match the GP one.
So you don't need to ALTER anything... Just change your definition or SELECT ... INTO
Yeah that seems to be the consensus. Thanks for making sure I wasn't doing anything stupid.
March 1, 2012 at 12:17 pm
aurato (3/1/2012)
SQLKnowItAll (3/1/2012)
aurato (3/1/2012)
SQLKnowItAll (3/1/2012)
Umm... Unless I missed something, you are trying to change the data type on a production table that is accessed by Great Plains? I'm not so sure it is a good idea to change a data type on a GP table. GP, in my experience, is extremely finicky. You change something on the database and you could be in for a world of hurt.Yeah read my last post I didn't mean to give that impression. I'm not gonna touch Great Plains. There is a third, unmentioned table in the original post that supplies the sopnumbes for my temp table. I meant that I wanted to change THAT column to match the GP one.
So you don't need to ALTER anything... Just change your definition or SELECT ... INTO
Yeah that seems to be the consensus. Thanks for making sure I wasn't doing anything stupid.
Not stupid... Ignorant. Which, unfortunately, I am king of 😛
Jared
CE - Microsoft
Viewing 7 posts - 16 through 21 (of 21 total)
You must be logged in to reply to this topic. Login to reply