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.
| Author |
Topic |
|
syedzulfi
Starting Member
4 Posts |
Posted - 2006-03-21 : 04:10:03
|
| Hi there,I'm new to SQL Server please help me, i want to create identity column(AutoNumber) when creating views. |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-03-21 : 04:31:34
|
| I dont think there is any way you can directly add the Autonumber to view.. like you do to the table.. There are some alternative methods of doing so.. Check out the link if these helps..http://support.microsoft.com/defaul...kb;en-us;186133Sucess Comes to those who Believe in Beauty of their Dream.. |
 |
|
|
syedzulfi
Starting Member
4 Posts |
Posted - 2006-03-21 : 04:37:49
|
| Thanks for your help, but the link which you've provided is not working...please tell me if there is any other way |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-03-21 : 04:52:35
|
| Use Front End application to number the rows. Where do you want to show the data?MadhivananFailing to plan is Planning to fail |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
|
|
syedzulfi
Starting Member
4 Posts |
Posted - 2006-03-29 : 00:31:11
|
| Once again Hi all,Actually i'm creating VIEW from the Columns of Two tables by linking the 7 columns and with some check options...the query iscreate view Q01A_View as select case dbo.Outage_Details.ACT_DATE_GRG when dbo.Rest_Details.ACT_DATE_GRG then '1' else '0' end AS CHK_ACTD,case dbo.Outage_Details.TOTAL_CUSTOMERS when dbo.Rest_Details.CUSTOMER_COUNT then '1' else '0' end AS CHK_CUS,case dbo.Outage_Details.TOTAL_VIPS when dbo.Rest_Details.VIP_COUNT then '1' else '0' end AS CHK_VIP,CASE DATEDIFF(MI,CAST(convert(nvarchar,dbo.rest_details.ACT_DATE_grg,101) + ' ' + substring(dbo.rest_details.OUT_TIME,1,2) + ':' + substring(dbo.rest_details.OUT_TIME,3,2) AS SMALLDATETIME),CAST(convert(nvarchar,dbo.rest_details.rest_DATE_grg,101) + ' ' + substring(dbo.rest_details.rest_TIME,1,2) + ':' + substring(dbo.rest_details.rest_TIME,3,2) AS SMALLDATETIME)) WHEN dbo.rest_details.DURATION_DAY * 24 * 60 + CONVERT(NUMERIC,SUBSTRING(dbo.rest_details.DURATION_HM,1,2)) * 60 + CONVERT(NUMERIC,SUBSTRING(dbo.rest_details.DURATION_HM,3,2)) THEN '1' ELSE '0' END AS CHK_DIR ,DURATION_DAY + (convert(numeric,substring(DURATION_HM,1,2) * 60) + convert(numeric,substring(DURATION_HM,3,2))) / (24 * 60) AS TOT_DIRfrom dbo.Outage_Details, dbo.Rest_Details where dbo.Outage_Details.RPT_DATE = dbo.Rest_Details.RPT_DATE and dbo.Outage_Details.MOA = dbo.Rest_Details.MOA and dbo.Outage_Details.OA = dbo.Rest_Details.OA and dbo.Outage_Details.DIST = dbo.Rest_Details.DIST and dbo.Outage_Details.ACT_DATE = dbo.Rest_Details.ACT_DATE and dbo.Outage_Details.OUT_TIME = dbo.Rest_Details.OUT_TIME and dbo.Outage_Details.OUT_SEQ = convert(nvarchar,dbo.Rest_Details.OUT_SEQ)from the above query i'm creating 5 queries but i need one more column as SQ_Num(AutoNumber)...here i need this columns for creating another query based on this query data...So let me know how to create identity column in view...I'll be thankful to you... |
 |
|
|
syedzulfi
Starting Member
4 Posts |
Posted - 2006-03-29 : 00:33:54
|
| Sorry i did some mistake in the above topic, instead of writing 5 columns i wrote 5 queries...please check... |
 |
|
|
|
|
|
|
|