Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

concatenate Expand / Collapse
Author
Message
Posted Tuesday, April 23, 2013 8:51 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, July 25, 2014 9:50 AM
Points: 58, Visits: 218
Can not figure out what I am doing wrong in table on I have FirstName and PhoneNumber and in the second table I have Carrier with @txt.***.Com etc. So when I write a proc to send text I want to be able to concatenate phonenumber and @txt.***.com together

Example
Select FirstName
,PhoneNumber + SMS
from Names as N
inner Join Carrier as C
on N.CarrierID = C.CarrierID
Post #1445490
Posted Tuesday, April 23, 2013 9:21 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 7:41 PM
Points: 23,033, Visits: 31,555
edward_hall76 (4/23/2013)
Can not figure out what I am doing wrong in table on I have FirstName and PhoneNumber and in the second table I have Carrier with @txt.***.Com etc. So when I write a proc to send text I want to be able to concatenate phonenumber and @txt.***.com together

Example
Select FirstName
,PhoneNumber + SMS
from Names as N
inner Join Carrier as C
on N.CarrierID = C.CarrierID


Okay, so what is the problem?



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1445518
Posted Tuesday, April 23, 2013 9:23 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 12:23 PM
Points: 258, Visits: 808
What is the datatype of PhoneNumber?
Post #1445520
Posted Tuesday, April 23, 2013 3:25 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, July 25, 2014 9:50 AM
Points: 58, Visits: 218
I have phonenumber and sms set as Text. The PhoneNumber is in the Names table and SMS is in the Carriers table.
Post #1445695
Posted Tuesday, April 23, 2013 3:26 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 7:41 PM
Points: 23,033, Visits: 31,555
edward_hall76 (4/23/2013)
I have phonenumber and sms set as Text. The PhoneNumber is in the Names table and SMS is in the Carriers table.


Still haven't answered the question, what is the problem??



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1445696
Posted Tuesday, April 23, 2013 3:26 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 2:20 PM
Points: 364, Visits: 384
Can you please confirm that the datatype is Text, as opposed to varchar(???) or nvarchar(???)?
Post #1445697
Posted Tuesday, April 23, 2013 3:26 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, July 25, 2014 9:50 AM
Points: 58, Visits: 218
I get this error Operand data type text is invalid for add operator
the PhoneNumber is in the Names table and the sms is in the Carriers table
Post #1445698
Posted Tuesday, April 23, 2013 3:28 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, July 25, 2014 9:50 AM
Points: 58, Visits: 218
yes they are text
Post #1445700
Posted Tuesday, April 23, 2013 3:29 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 7:41 PM
Points: 23,033, Visits: 31,555
edward_hall76 (4/23/2013)
I get this error Operand data type text is invalid for add operator
the PhoneNumber is in the Names table and the sms is in the Carriers table


Okay, now we need to see the DDL (CREATE TABLE statements) for the tables. I'm not sure which column is what data type. Looks like you will need to cast one or both to a varchar data type.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1445701
Posted Tuesday, April 23, 2013 3:29 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 2:20 PM
Points: 364, Visits: 384
Text, ntext and image are special data types that does not support the normal string operators.
If you want to concatenate, you'll need to cast each field into varchar or nvarchar first.
Post #1445702
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse