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

Time:12-31

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?

CodePudding user response:

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
  • Related