In a view, I want to add a column that isn't in the table I'm selecting from that I name and has 1 set value for each record in the view
Category: sql server datamining
Question
Bouje on Tue, 15 Dec 2015 21:28:19
This is easy to do in access. For example, in SQL view, I simply type "Dog" as [Type], and the query will automatically add a field called Type that has Dog in every record it returns. How do I do this in SQL Server?
Replies
bhanu_nz on Tue, 15 Dec 2015 22:29:00
Hi,
You can do the same in SQL Server as well
CREATE VIEW test_vw AS SELECT *,'testText' AS test FROM [dbo].[table]
select * from test_vw
Hope this helps
Thanks
Bhanu