Skip to content
Advertisement

Azure hosted SQL: show all fields in a table as a saved View

Probably a simple answer, but assume I have a table with 3 columns:

ab, cd, ef

I create a new view

SELECT * 
FROM tbl

It works. I save the view, SSMS automatically changes the saved version of the view to say:

SELECT dbo.tbl.ab, dbo.tbl.cd, dbo.tbl.ef

How do I keep the saved version of the view to include all columns in tbl rather than explicitly identifying each column?

Advertisement

Answer

You can create the view like this:

CREATE VIEW vwTbl
AS
SELECT *
FROM tbl

Then you can query the view to retrieve all columns like:

SELECT * FROM vwTbl
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement