Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 12890

Computed Column Adding 3 columns together

$
0
0

Hi



I am trying to create a computed column in a SQL table to show 3 columns in the same table joined together to make a long string.



I currently have the following:



CREATE

TABLE[dbo].[Item_Details1](

[Product_Description][nvarchar](255)NOTNULL,

[Manufacturer_Part_No][nvarchar](255)NULL,

[Preferred_Supplier][nvarchar](255)NOTNULL,

[Srch_Field]As[Product_Description]+[Preferred_Supplier]+[Manufacturer_Part_No]



I have also tried:



CONCAT([Product_Description],[Preferred_Supplier],[Manufacturer_Part_No])



CAST([Product_Description] as NVARCHAR(MAX)) & CAST([Preferred_Supplier] as NVARCHAR(MAX))& CAST([Manufacturer_Part_No]) as NVARCHAR(MAX))



[Product_Description]&[Preferred_Supplier]&[Manufacturer_Part_No]



See what I am trying to do next once the table is Linked in Access is to search this field and filter based on the content as supplied in a search text box.



Any Ideas?




Viewing all articles
Browse latest Browse all 12890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>