|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 10:43 AM
Points: 1,146,
Visits: 1,848
|
|
I agree with "J"!
Although I had selected "change the data type to varchar(max)" I removed it as the scenario had stated that no duplicates could be assumed. Therefore, the only proper solution (workaround) to the problem stated was to use UNION ALL -- which, by the way should have used in the first place if the data is not duplicated between the two tables.
A data type change to a table is NOT a "workaround".
(PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Monday, September 14, 2009 5:22 AM
Points: 438,
Visits: 918
|
|
Now,
69% of reponses were right (UNION ALL).
So, peasants, let's organize. Pick up your torches and pitchforks and let's all walk up to Frankenstein's castle!
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 1:39 PM
Points: 1,355,
Visits: 1,740
|
|
JohnG (11/6/2008) A data type change to a table is NOT a "workaround".
While I agree that a datatype change to an existing production table may not be a work-around, I do think this is an important idea for future design - to move away from the use of text datatypes and use varchar(max) instead.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 10:43 AM
Points: 1,146,
Visits: 1,848
|
|
Carla Wilson (11/6/2008)
JohnG (11/6/2008) A data type change to a table is NOT a "workaround".While I agree that a datatype change to an existing production table may not be a work-around, I do think this is an important idea for future design - to move away from the use of text datatypes and use varchar(max) instead.
Totally agree that the new "max" data types should be used vs. TEXT and NTEXT for all new development work. And, where possible, they should be changed in existing applications. However, such a change is not simple as code (T-SQL or other) may be using special functions and/or methods that are only applicable to TEXT and NTEXT.
The scenario presented would indicate that it was an existing application as a "workaround" (sic) was needed. If on the other hand, the scenario had started off with "you are designing tables for a new application..." the "change the data type" answer would apply.
(PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 1:42 PM
Points: 3,487,
Visits: 1,581
|
|
It was my understanding that varchar(max) was meant to be a replacement to the text data type because of the issue that this question raises as well as other like:
Being able to use varchar(max) as a local variable (can't with text) Being able to use most string functions with it
It can still hold 2Gb of data like text can, so what would this break?
Please correct me if I'm wrong. These discussions are great!
Greg
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 10:43 AM
Points: 1,146,
Visits: 1,848
|
|
G² (11/6/2008) It was my understanding that varchar(max) was meant to be a replacement to the text data type because of the issue that this question raises as well as other like:
Being able to use varchar(max) as a local variable (can't with text) Being able to use most string functions with it
It can still hold 2Gb of data like text can, so what would this break?
Please correct me if I'm wrong. These discussions are great!
Greg
Yes, all of the above is true. That is why I have changed my usage when we dropped SQL Server 2000 support. As to breakage, the application could be using READTEXT, WRITETEXT, UPDATETEXT, TEXTPTR, etc. See the BOL for details.
(PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 1:42 PM
Points: 3,487,
Visits: 1,581
|
|
JohnG (11/6/2008)
G² (11/6/2008) It was my understanding that varchar(max) was meant to be a replacement to the text data type because of the issue that this question raises as well as other like:
Being able to use varchar(max) as a local variable (can't with text) Being able to use most string functions with it
It can still hold 2Gb of data like text can, so what would this break?
Please correct me if I'm wrong. These discussions are great!
Greg
Yes, all of the above is true. That is why I have changed my usage when we dropped SQL Server 2000 support. As to breakage, the application could be using READTEXT, WRITETEXT, UPDATETEXT, TEXTPTR, etc. See the BOL for details.
That's a good point. I hadn't thought of the text specific functions.
Thanks,
Greg
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 10:43 AM
Points: 1,146,
Visits: 1,848
|
|
G² (11/6/2008) [quote] That's a good point. I hadn't thought of the text specific functions.
Thanks,
Greg
Now you know why just performing an "ALTER TABLE" to change the data type could not be considered a "workaround" to the specific query problem. The entire application could fail.
(PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Monday, September 14, 2009 5:22 AM
Points: 438,
Visits: 918
|
|
DOCTOR FRANKENSTEIN
OPEN UP !
|
|
|
|
|
SSC-Insane
         
Group: General Forum Members
Last Login: Today @ 9:51 PM
Points: 21,627,
Visits: 27,482
|
|
|
|
|