Can I get the value of newid() function of SQLserver2k from ASP
-
ASP & SQLserver2k & Windows2003 I use ASP to add data to 2 tables I have 2 tables: Invoice and InvoiceDetail Invoice contains: InvoiceID, ClientName, InvoiceDate........ InvoiveDetail contains: InvoiceID, Name,Price,Quantity.... I set default of InvoiceID(Invoice table)=newid() so I dont need to insert a new value when I add a new record but I can not get value of newid() Example: Invoice for Client "Tom" I use "INSERT Invoice (ClientName, InvoiceDate) VALUES ('Tom','30/1/2004')" and SQLserver2k auto create a value for InvoiceID such as {BB10687B-87F7-44E4-9397-8D510BBDFA9C} and then ..... I WANT TO GET {BB10687B-87F7-44E4-9397-8D510BBDFA9C} I NEED IT to add detail of this invoice for InvoiceDetail table like: InvoiceID - Name - Price - Quantity {BB10687B-87F7-44E4-9397-8D510BBDFA9C} - book - 26.5$ - 5 {BB10687B-87F7-44E4-9397-8D510BBDFA9C} - CD - 700.95$ - 1 I think 1) SELECT InvoiceID FROM Invoice WHERE ClientName='Tom' AND InvoiceDate='30/1/2004'" but this is not good, may be duplicate all value in all column 2) May I have to add a new column in table 3) I have to calculate my InvoiceID and not use newid() function of SQLsrv2k :(( Please help me to get value of newid() function in SQLserver2k thanks alot
-
ASP & SQLserver2k & Windows2003 I use ASP to add data to 2 tables I have 2 tables: Invoice and InvoiceDetail Invoice contains: InvoiceID, ClientName, InvoiceDate........ InvoiveDetail contains: InvoiceID, Name,Price,Quantity.... I set default of InvoiceID(Invoice table)=newid() so I dont need to insert a new value when I add a new record but I can not get value of newid() Example: Invoice for Client "Tom" I use "INSERT Invoice (ClientName, InvoiceDate) VALUES ('Tom','30/1/2004')" and SQLserver2k auto create a value for InvoiceID such as {BB10687B-87F7-44E4-9397-8D510BBDFA9C} and then ..... I WANT TO GET {BB10687B-87F7-44E4-9397-8D510BBDFA9C} I NEED IT to add detail of this invoice for InvoiceDetail table like: InvoiceID - Name - Price - Quantity {BB10687B-87F7-44E4-9397-8D510BBDFA9C} - book - 26.5$ - 5 {BB10687B-87F7-44E4-9397-8D510BBDFA9C} - CD - 700.95$ - 1 I think 1) SELECT InvoiceID FROM Invoice WHERE ClientName='Tom' AND InvoiceDate='30/1/2004'" but this is not good, may be duplicate all value in all column 2) May I have to add a new column in table 3) I have to calculate my InvoiceID and not use newid() function of SQLsrv2k :(( Please help me to get value of newid() function in SQLserver2k thanks alot