Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi All.
I have a confusion in using 'With Clause' and 'View' in SQL Server 2012,and Need an example and difference between these two.

What I have tried:

I have tried both But Dunno in what scenario we can use these?
Posted
Updated 29-Aug-16 18:57pm

Start reading MSDN documentation:
SELECT - SQL Command - WITH Clause[^]
Views[^]
There you'll find tons of examples and you'll be able to list all differences.

Few basic differences were listed here:
Difference between SQL View and WITH clause - Stack Overflow[^]
 
Share this answer
 
SQL views and with clauses are very similar to each other.

Some difference
VIEW is a database object, WITH is a clause that is used in DML.
View create an actual object in the database, With statements are only part if a single query.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900