Click here to Skip to main content
15,895,011 members
Home / Discussions / Database
   

Database

 
GeneralRe: CREATE FUNCTION in SQL Server Version 7? Pin
-Dr_X-21-Apr-04 18:40
-Dr_X-21-Apr-04 18:40 
GeneralRe: CREATE FUNCTION in SQL Server Version 7? Pin
Jeff Varszegi22-Apr-04 10:51
professionalJeff Varszegi22-Apr-04 10:51 
GeneralRe: CREATE FUNCTION in SQL Server Version 7? Pin
Sylvain-Marc Girard27-Apr-04 7:51
sussSylvain-Marc Girard27-Apr-04 7:51 
General1002 (AFX_SQL_ERROR_RECORDSET_FORWARD_ONLY)) Error When opening Recordset Pin
petecg21-Apr-04 6:01
petecg21-Apr-04 6:01 
GeneralSql server CE newbie Pin
Lvca21-Apr-04 2:37
Lvca21-Apr-04 2:37 
Generalproblem use ado with stored procedure Pin
Satervalley20-Apr-04 23:10
Satervalley20-Apr-04 23:10 
GeneralGet value of newid() function of SQLsrv2k from ASP Pin
_skidrow_vn_20-Apr-04 22:16
_skidrow_vn_20-Apr-04 22:16 
GeneralRe: Get value of newid() function of SQLsrv2k from ASP Pin
-Dr_X-21-Apr-04 19:53
-Dr_X-21-Apr-04 19:53 
From what little testing I have done, I don't thing you will be able to obtain the GUID from the table after an insert like with an auto incrementing or random integer column. With an integer you can use SELECT @ID = @@Idendity. But it doesn't appear to work with the GUID.
DROP TABLE tempdb..TestGUID
DROP TABLE tempdb..TestAutoID 
GO
CREATE TABLE tempdb..TestGUID (
	ID  uniqueidentifier ROWGUIDCOL Not NULL  DEFAULT (newid()),
	TestValue varchar(50)
) 


CREATE TABLE tempdb..TestAutoID (
	ID  int Identity (1, 1) Not Null,
	TestValue varchar(50)
) 
GO

INSERT INTO tempdb..TestGUID
( TestValue )
SELECT 'Test GUID'
SELECT @@Identity 

INSERT INTO tempdb..TestAutoID
( TestValue )
SELECT 'Test Integer ID'
SELECT @@Identity 

SELECT * FROM tempdb..TestGUID
SELECT * FROM tempdb..TestAutoID
OutPut
(1 row(s) affected)

                                         
---------------------------------------- 
NULL

(1 row(s) affected)


(1 row(s) affected)

                                         
---------------------------------------- 
1

(1 row(s) affected)

ID                                   TestValue                                          
------------------------------------ -------------------------------------------------- 
E51F034D-BD69-4A34-9983-A2B1007FBA74 Test GUID

(1 row(s) affected)

ID          TestValue                                          
----------- -------------------------------------------------- 
1           Test Integer ID

(1 row(s) affected)
As you can see the @@Identity returns a null for the GUID and the actual value for the integer ID. You may have to obtain the GUID value prior to the insert by placing it in a variable. Then you can use the variable in both the header and detail tables.

Sorry I couldn't be much more help.
Michael

I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
GeneralJoin Pin
Robert197420-Apr-04 8:10
Robert197420-Apr-04 8:10 
GeneralRe: Join Pin
-Dr_X-20-Apr-04 9:47
-Dr_X-20-Apr-04 9:47 
GeneralRe: Join Pin
Robert197420-Apr-04 10:19
Robert197420-Apr-04 10:19 
GeneralCorrection Pin
Jeff Varszegi21-Apr-04 7:38
professionalJeff Varszegi21-Apr-04 7:38 
GeneralSQL statement execution plan (SQL Server 2000) Pin
Xiangyang Liu 刘向阳20-Apr-04 4:35
Xiangyang Liu 刘向阳20-Apr-04 4:35 
GeneralRe: SQL statement execution plan (SQL Server 2000) Pin
Mike Dimmick20-Apr-04 6:11
Mike Dimmick20-Apr-04 6:11 
GeneralRe: SQL statement execution plan (SQL Server 2000) Pin
XiangYangLiu20-Apr-04 22:16
sussXiangYangLiu20-Apr-04 22:16 
GeneralRunning Oracle SQL DDL from the IDE Pin
Ranjan Banerji20-Apr-04 4:13
Ranjan Banerji20-Apr-04 4:13 
GeneralRe: Running Oracle SQL DDL from the IDE Pin
RichardGrimmer21-Apr-04 2:27
RichardGrimmer21-Apr-04 2:27 
GeneralRe: Running Oracle SQL DDL from the IDE Pin
Ranjan Banerji27-Apr-04 4:10
Ranjan Banerji27-Apr-04 4:10 
GeneralRe: Running Oracle SQL DDL from the IDE Pin
RichardGrimmer27-Apr-04 4:38
RichardGrimmer27-Apr-04 4:38 
GeneralVisual Admin Tool for MSDE Pin
Michael P Butler20-Apr-04 2:37
Michael P Butler20-Apr-04 2:37 
GeneralRe: Visual Admin Tool for MSDE Pin
RichardGrimmer21-Apr-04 2:29
RichardGrimmer21-Apr-04 2:29 
GeneralRe: Visual Admin Tool for MSDE Pin
Michael P Butler21-Apr-04 2:54
Michael P Butler21-Apr-04 2:54 
GeneralRe: Visual Admin Tool for MSDE Pin
mtone5-May-04 4:55
mtone5-May-04 4:55 
GeneralNamed Commands in ADO from C++ Pin
[James Pullicino]20-Apr-04 1:19
[James Pullicino]20-Apr-04 1:19 
GeneralRe: Named Commands in ADO from C++ Pin
Mike Dimmick20-Apr-04 3:29
Mike Dimmick20-Apr-04 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.