Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a [TABLE] with 3 columns like this:

[Column1-smallint] [Column2-nvarchar] [Column3-nvarchar]

I would like to create a new view with only 1 column like this:

[Column1 & Column2 & Column3]

If I try:

SELECT [Column1 & Column2 & Column3] AS [NewColumnName] FROM dbo.table

It complains about Conversion failed when converting the nvarchar data type smallint

How do I force convert everything to NVARCHAR in the new view?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Perhaps this is sufficient enough for your needs:

SELECT (CONVERT(nvarchar, Column1) + CONVERT(nvarchar, Column2) + CONVERT(nvarchar, Column3)) AS[NewColumnName] FROM dbo.Table
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.