Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 view help

Author  Topic 

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-12-13 : 01:13:17
hi iam having table abc with three fields

STATE_ID,STATE_NAME,STATE_CODE
now i want to create a view on this but i want 1 and 2 columns only
STATE_ID,STATE_NAME,STATUS.

STATUS IS NOT THERE but i want to include STATUS and show it 1 by default.how to do this.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-13 : 01:17:19
CREATE VIEW view1
AS
SELECT STATE_ID, STATE_NAME, 1 AS STATUS
FROM YourTable
GO

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -