Multiple inserts

  • doh!

     

  • yup.

  • Remi, I noticed something in that big script...I have MyCmd.Execute at the beginng AND the end...

    Dim MyCn

    Set MyCn = Server.CreateObject("ADODB.Connection")

    Set MyCmd = Server.CreateObject("ADODB.Command")

    MyCn.Open = "DSN=OSUNet;UID=xxxx;PWD=xxxxxxxx"

    Set MyCMd.ActivateConnection = MyCn

    MyCmd.CommandType = adCmdStoredProc

    MyCmd.CommandText = "dbo.sp_biginsert"

    MyCmd.Execute

    ..............

    MyCn.Open

    MyCmd.ActiveConnection = MyCn

    MyCmd.Execute

    MyCn.Close

    ReturnValue = CInt(MyCmd.Parameters("@Return").Value)

    Set MyParam = Nothing

    Set MyCmd = Nothing

  • Yup you have one too much... the script will fail because you haven't set any parameters yet.

  • should I just take out the 'MyCmd.Execute' at the top of the script?  Or should I take out all the lines:

    Dim MyCn

    Set MyCn = Server.CreateObject("ADODB.Connection")

    Set MyCmd = Server.CreateObject("ADODB.Command")

    MyCn.Open = "DSN=OSUNet;UID=xxxx;PWD=xxxxxxxx"

    Set MyCMd.ActivateConnection = MyCn

    MyCmd.CommandType = adCmdStoredProc

    MyCmd.CommandText = "dbo.sp_biginsert"

    MyCmd.Execute

    and then combine them at the bottom like:

    Dim MyCn

    Set MyCn = Server.CreateObject("ADODB.Connection")

    Set MyCmd = Server.CreateObject("ADODB.Command")

    MyCn.Open = "DSN=OSUNet;UID=xxxx;PWD=xxxxxxxx"

    Set MyCMd.ActivateConnection = MyCn

    MyCmd.CommandType = adCmdStoredProc

    MyCmd.CommandText = "dbo.sp_biginsert"

    MyCmd.Execute

    MyCn.Close

    ReturnValue = CInt(MyCmd.Parameters("@Return").Value)

    Set MyParam = Nothing

    Set MyCmd = Nothing

  • Dude, make a new sp with 1 parameter like I already asked you to do.

    Take the original code I sent you, MAKE IT WORK WITH THAT SP, then modify this one using your new found template. I can't debug this for you as I can't be in front of the computer and ASP is a pain in the ass for debugging. If you still have problems after that come back to me.

  • Well, I'm not a dude...I'm a dudette.

     

    Anyway, I already got the SP to work that we talked about for like 5 pages of this thread.  I understand that you are busy and I greatly appreciate your help.  I'm just trying to understand the asp code and hopefully I'm not doing something stupid.

     

     

  • Sorry dudette. That's what I meant, make something small work first, then go takle that monster. I can't make it work for you if I'm not there and that just ain't gonna happen, so you have to learn yourself.

  • Hey Remi! 

    It's working at 90%!  But for some reason, the UniqueIDs that are supposed to appear in every table, are turning up NULL....even in the first table!

    In the SP, I get the UniqueID with Select @UniqueId=Scope_Identity(), @Err = @@ERROR

    I then insert that UniqueID into all the other tables...

    Here's my SP:

    create procedure dbo.sp_biginsert

    @SRrequestDate varchar(50),

    @SRschoolNameFirst varchar(150),

    @SRschoolNameLast varchar(150),

    @SRschoolCompany varchar(150),

    @SRschoolBranch varchar(150),

    @SRschoolAddress1 varchar(150),

    @SRschoolAddress2 varchar(150),

    @SRschoolCity varchar(150),

    @SRschoolState char(10),

    @SRschoolZip varchar(20),

    @SRschoolPhone varchar(35),

    @SRschoolFax varchar(35),

    @SRschoolEmail varchar(50),

    @SRschoolRegion varchar(75),

    @SRschoolSupervisor varchar(75),

    @SRschoolclaimType varchar(50),

    @SRschoolDateOfLoss varchar(50),

    @SRschoolInsured varchar(50),

    @SRschoolClaimNumber varchar(50),

    @SRschoolPackaging varchar(50),

    @SRschoolContactPrefs varchar(50),

    @SRclaimantNameFirst varchar(150),

    @SRclaimantNameMiddle varchar(150),

    @SRclaimantNameLast varchar(150),

    @SRclaimantOffice varchar(150),

    @SRclaimantAddress1 varchar(150),

    @SRclaimantAddress2 varchar(150),

    @SRclaimantCity varchar(150),

    @SRclaimantState char(10),

    @SRclaimantZip varchar(20),

    @SRclaimantPhone varchar(35),

    @SRclaimantDateOfBirth char(50),

    @SRclaimantSSN char(10),

    @SRclaimantSex char(10),

    @SRclaimantMaritalStatus char(10),

    @SRclaimantSpouse varchar(150),

    @SRclaimantChildrenNum char(15),

    @SRclaimantChildrenAges varchar(25),

    @SRclaimantRace char(75),

    @SRclaimantHeightLow char(75),

    @SRclaimantHeightHigh char(75),

    @SRclaimantWeightLow char(75),

    @SRclaimantWeightHigh char(75),

    @SRclaimantSpecialChar varchar(500),

    @SRclaimantOccupation varchar(50),

    @SRclaimantInjury varchar(500),

    @SRclaimantRestrictions varchar(500),

    @SRclaimantRepresented char(75),

    @SRclaimantVehicle1Make varchar(75),

    @SRclaimantVehicle1Model varchar(75),

    @SRclaimantVehicle1Tag varchar(75),

    @SRclaimantVehicle2Make varchar(75),

    @SRclaimantVehicle2Model varchar(75),

    @SRclaimantVehicle2Tag varchar(75),

    @SRsubjectEmployer varchar(150),

    @SREmployerNameFirst varchar(150),

    @SREmployerNameLast varchar(150),

    @SREmployerAddress1 varchar(150),

    @SREmployerAddress2 varchar(150),

    @SREmployerCity varchar(150),

    @SREmployerState char(10),

    @SREmployerZip varchar(20),

    @SREmployerPhone varchar(35),

    @SREmployerContact char(3),

    @SREmployerInfo varchar(500),

    @SRcollegeNameFirst varchar(150),

    @SRcollegeNameLast varchar(150),

    @SRcollegeAddress1 varchar(150),

    @SRcollegeAddress2 varchar(150),

    @SRcollegeCity varchar(150),

    @SRcollegeState char(10),

    @SRcollegeZip varchar(20),

    @SRcollegePhone varchar(35),

    @SRcollegeCopyOnReports char(3),

    @SRcollegeContact char(3),

    @SRcollegeInfo varchar(500),

    @SRrehabCompany varchar(150),

    @SRrehabNameFirst varchar(150),

    @SRrehabNameLast varchar(150),

    @SRrehabAddress1 varchar(150),

    @SRrehabAddress2 varchar(150),

    @SRrehabCity varchar(150),

    @SRrehabState char(10),

    @SRrehabZip varchar(20),

    @SRrehabPhone varchar(35),

    @SRrehabContact char(3),

    @SRrehabInfo varchar(500),

    @SRbuildingNameFirst varchar(150),

    @SRbuildingNameLast varchar(150),

    @SRbuildingAddress1 varchar(150),

    @SRbuildingAddress2 varchar(150),

    @SRbuildingCity varchar(150),

    @SRbuildingState char(10),

    @SRbuildingZip varchar(20),

    @SRbuildingPhone varchar(35),

    @SRbuildingContact char(3),

    @SRbuildingInfo varchar(500),

    @SRreason varchar(500),

    @SRobjective1 varchar(500),

    @SRobjective2 varchar(500),

    @SRobjective3 varchar(500),

    @SRbudgetAmount char(10),

    @SRsingleDaySurv char(10),

    @SRsceneInvestigation char(10),

    @SRactivityCheck char(10),

    @SRresidencyCheck char(10),

    @SRmultidaySurv char(10),

    @SRstatement varchar(500),

    @SRbackgroundCheck char(10),

    @SRwidowCheck char(10),

    @SRhospitalCanvass char(10),

    @SRdueDate varchar(50),

    @SRcomments varchar(500)

    AS

    Declare @UniqueID int, @Err int

    BEGIN TRANSACTION

    SET NOCOUNT ON

    INSERT INTO FG_college_Info(SRcollegeNameFirst, SRcollegeNameLast,

    SRcollegeAddress1, SRcollegeAddress2, SRcollegeCity, SRcollegeState, SRcollegeZip,

    SRcollegePhone, CopyOnReports, SRcollegeContact, SRcollegeInfo) VALUES

    (@SRcollegeNameFirst, @SRcollegeNameLast, @SRcollegeAddress1, @SRcollegeAddress2, @SRcollegeCity,

    @SRcollegeState, @SRcollegeZip, @SRcollegePhone, @SRcollegeCopyOnReports, @SRcollegeContact, @SRcollegeInfo)

    Select @UniqueId=Scope_Identity()

    if @Err <> 0 Goto QuitWithRollBack

    INSERT INTO FG_school_Info(SR_school_Info_ID,SRrequestDate, SRschoolNameFirst, SRschoolNameLast, SRschoolCompany,

    SRschoolBranch, SRschoolAddress1, SRschoolAddress2, SRschoolCity, SRschoolState, SRschoolZip,

    SRschoolPhone, SRschoolFax, SRschoolEmail, SRschoolRegion, SRschoolSupervisor,

    SRschoolClaimType, SRschoolDateOfLoss, SRschoolInsured, SRschoolPackaging, SRschoolContactPrefs)

    VALUES(@UniqueId, @SRrequestDate, @SRschoolNameFirst, @SRschoolNameLast, @SRschoolCompany,

    @SRschoolBranch, @SRschoolAddress1, @SRschoolAddress2, @SRschoolCity, @SRschoolState, @SRschoolZip,

    @SRschoolPhone, @SRschoolFax, @SRschoolEmail, @SRschoolRegion, @SRschoolSupervisor,

    @SRschoolClaimType, @SRschoolDateOfLoss, @SRschoolInsured, @SRschoolPackaging, @SRschoolContactPrefs)

    if @Err <> 0 Goto QuitWithRollBack

    INSERT INTO FG_Claimant_Info(SR_Claimant_Info_Id, SRclaimantNameFirst, SRclaimantNameMiddle, SRclaimantNameLast, SRclaimantOffice,

    SRclaimantAddress1, SRclaimantAddress2, SRclaimantCity, SRclaimantState, SRclaimantZip, SRclaimantPhone,

    SRclaimantDateOfBirth, SRclaimantSSN, SRclaimantSex, SRclaimantMaritalStatus, SRclaimantSpouse,

    SRclaimantChildrenNum, SRclaimantChildrenAges, SRclaimantRace, SRclaimantHeightLow, SRclaimantHeightHigh,

    SRclaimantWeightLow, SRclaimantWeightHigh, SRclaimantSpecialChar, SRclaimantOccupation, SRclaimantInjury,

    SRclaimantRestrictions, SRclaimantRepresented, SRclaimantVehicle1Make, SRclaimantVehicle1Model,

    SRclaimantVehicle1Tag, SRclaimantVehicle2Make, SRclaimantVehicle2Model, SRclaimantVehicl2Tag) VALUES(@UniqueId,

    @SRclaimantNameFirst, @SRclaimantNameMiddle, @SRclaimantNameLast, @SRclaimantOffice,

    @SRclaimantAddress1, @SRclaimantAddress2, @SRclaimantCity, @SRclaimantState, @SRclaimantZip, @SRclaimantPhone,

    @SRclaimantDateOfBirth, @SRclaimantSSN, @SRclaimantSex, @SRclaimantMaritalStatus, @SRclaimantSpouse,

    @SRclaimantChildrenNum, @SRclaimantChildrenAges, @SRclaimantRace, @SRclaimantHeightLow, @SRclaimantHeightHigh,

    @SRclaimantWeightLow, @SRclaimantWeightHigh, @SRclaimantSpecialChar, @SRclaimantOccupation, @SRclaimantInjury,

    @SRclaimantRestrictions, @SRclaimantRepresented, @SRclaimantVehicle1Make, @SRclaimantVehicle1Model,

    @SRclaimantVehicle1Tag, @SRclaimantVehicle2Make, @SRclaimantVehicle2Model, @SRclaimantVehicle2Tag)

    if @Err <> 0 Goto QuitWithRollBack

    INSERT INTO FG_Employer_Info(SR_Employer_Info_ID, SRsubjectEmployer, SRemployerNameFirst, SRemployerNameLast,

    SRemployerAddress1, SRemployerAddress2, SRemployerCity, SRemployerState, SRemployerZip, SRemployerPhone,

    SRemployerContact, SRemployerInfo)VALUES(@UniqueId, @SRsubjectEmployer, @SRemployerNameFirst, @SRemployerNameLast,

    @SRemployerAddress1, @SRemployerAddress2, @SRemployerCity, @SRemployerState, @SRemployerZip, @SRemployerPhone,

    @SRemployerContact, @SRemployerInfo)

    if @Err <> 0 Goto QuitWithRollBack

    INSERT INTO FG_Rehab_Info(SR_Rehab_Inof, SRrehabCompany, SRrehabNameFirst, SRrehabNameLast, SRrehabAddress1,

    SRrehabAddress2, SRrehabCity, SRrehabState, SRrehabZip, SRrehabPhone, SRrehabContact, SRrehabInfo)

    VALUES(@UniqueId, @SRrehabCompany, @SRrehabNameFirst, @SRrehabNameLast, @SRrehabAddress1,

    @SRrehabAddress2, @SRrehabCity, @SRrehabState, @SRrehabZip, @SRrehabPhone, @SRrehabContact, @SRrehabInfo)

    if @Err <> 0 Goto QuitWithRollBack

    INSERT INTO FG_building_Info(SR_building_Info_ID, SRbuildingNameFirst, SRbuildingNameLast, SRbuildingAddress1,

    SRbuildingAddress2, SRbuildingCity, SRbuildingState, SRbuildingZip, SRbuildingPhone,

    SRbuildingContact, SRbuildingInfo) VALUES(@UniqueId, @SRbuildingNameFirst, @SRbuildingNameLast, @SRbuildingAddress1,

    @SRbuildingAddress2, @SRbuildingCity, @SRbuildingState, @SRbuildingZip, @SRbuildingPhone,

    @SRbuildingContact, @SRbuildingInfo)

    if @Err <> 0 Goto QuitWithRollBack

    INSERT INTO FG_Specific_Instructions(SR_Specific_Instructions_ID, SRreason, SRobjective1, SRobjective2, SRobjective3, SRbudgetAmount,

    SRsingleDaySurv, SRsceneInvestigation, SRactivityCheck, SRresidencyCheck, SRmultidaySurv, SRstatement,

    SRbackgroundCheck, SRwidowCheck, SRhospitalCanvass, SRdueDate, SRcomments) VALUES (@UniqueId, @SRreason, @SRobjective1, @SRobjective2, @SRobjective3, @SRbudgetAmount,

    @SRsingleDaySurv, @SRsceneInvestigation, @SRactivityCheck, @SRresidencyCheck, @SRmultidaySurv, @SRstatement,

    @SRbackgroundCheck, @SRwidowCheck, @SRhospitalCanvass, @SRdueDate, @SRcomments)

    if @Err <> 0 Goto QuitWithRollBack

    SET NOCOUNT OFF

    GO

    COMMIT TRANSACTION

    Return 0

    QuitWithRollBack:

     ROLLBACK TRAN

     Return @Err

     

  • You never actually use this :

    Select @UniqueId=Scope_Identity(), @Err = @@ERROR

    you must select the err code after EACH INSERT

    also is the first insert's id an identity column??

  • Remi,  my fault...I had two tables switched around.  I am now getting UniqueIDs inserted into all the tables.

    Just a stupid-sounding question...now that this all "works"  How can one select columns from all of these tables with the same UniqueID?

    Like if I want to do a SELECT * FROM "multiple_tables" WHERE "UniqueIDofEachTable" = 2

     

    Thanky muchy!

     

     

  • Send me the creation script from all the tables (including the relations) an dI'll build it.

  • Remi,

    You don't have to build it, maybe just explain it, but it would probably be faster to build it, then let me go get a good SQL book and explain it to myself.

    Anyway, I have the creation scripts. But I'm not sure where to find the relations.  The only way that the tables relate to each other is that they all come from the same form.  And the first column of each table is the same in each table.

    That's why I was asking how would I do a SELECT statement for all the tables, where the UniqueId of each table was the same. 

    ---scripts---

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FG_school_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[FG_school_Info]

    GO

    CREATE TABLE [dbo].[FG_school_Info] (

     [SRschoolID] [int] IDENTITY (1, 1) NOT NULL ,

     [SRschoolNameFirst] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolNameLast] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolCompany] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolBranch] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolAddress1] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolAddress2] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolCity] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolState] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolZip] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolPhone] [varchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolFax] [varchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolEmail] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolRegion] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolSupervisor] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolclaimType] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschooldateOfLoss] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolinsured] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolclaimNumber] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolpackaging] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolcontactPrefs] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRschoolClinkID] [int] NULL ,

     [SRrequestDate] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRrequestSubmitted] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FG_building_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[FG_building_Info]

    GO

    CREATE TABLE [dbo].[FG_building_Info] (

     [SRbuildingID] [int] NULL ,

     [SRbuildingCompany] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingNameFirst] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingNameLast] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingAddress1] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingAddress2] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingCity] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingState] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingZip] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingPhone] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingContact] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbuildingInfo] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FG_Claimant_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[FG_Claimant_Info]

    GO

    CREATE TABLE [dbo].[FG_Claimant_Info] (

     [SRclaimantID] [int] NULL ,

     [SRclaimantNameFirst] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantNameLast] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantNameMiddle] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantOffice] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantAddress1] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantAddress2] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantCity] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantState] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantZip] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantPhone] [varchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantDateOfBirth] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantSSN] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantRace] [char] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantHairColor] [char] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantHeightLow] [char] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantHeightHigh] [char] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantWeightLow] [char] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantWeightHigh] [char] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantSex] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantMaritalStatus] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantSpouseName] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantSpecialChar] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantOccupation] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantHobbies] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantInjury] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantRestrictions] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantChildrenNum] [char] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantChildrenAges] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantRepresented] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantVehicle1Make] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantVehicle2Make] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantVehicle1Tag] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantVehicle2Tag] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantVehicle1Model] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRclaimantVehicle2Model] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FG_college_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[FG_college_Info]

    GO

    CREATE TABLE [dbo].[FG_college_Info] (

     [SRcollegeID] [int] NULL ,

     [SRcollegeNameFirst] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcollegeNameLast] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcollegeAddress1] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcollegeAddress2] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcollegeCity] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcollegeState] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcollegeZip] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcollegePhone] [varchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcopyOnReports] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcollegeContact] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcollegeInfo] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FG_Employer_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[FG_Employer_Info]

    GO

    CREATE TABLE [dbo].[FG_Employer_Info] (

     [SRemployerID] [int] NULL ,

     [SRsubjectEmployer] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerNameFirst] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerNameLast] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerAddress1] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerAddress2] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerCity] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerState] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerZip] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerPhone] [varchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerContact] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRemployerInfo] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FG_Physician_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[FG_Physician_Info]

    GO

    CREATE TABLE [dbo].[FG_Physician_Info] (

     [SRphysicianID] [int] NULL ,

     [SRphysicianNameFirst] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRphysicianNameLast] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRphysicianAddress1] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRphysicianAddress2] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRphysicianCity] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRphysicianState] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRphysicianZip] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRphysicianPhone] [varchar] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRphysicianContact] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRphysicianInfo] [char] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FG_Specific_Instructions]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[FG_Specific_Instructions]

    GO

    CREATE TABLE [dbo].[FG_Specific_Instructions] (

     [SRSpecInstID] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRreason] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRobjective1] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRobjective2] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRobjective3] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbudgetAmount] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRsingleDaySurv] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRmultidaySurv] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRdueDate] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcomments] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRbackgroundCHeck] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRhospitalCanvass] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRsceneInvestigation] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRresidencyCheck] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRstatement] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRactivityCheck] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRwidowCheck] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRreferralBasisPNI] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRreferralReasonsPNI] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRsiuIndicatorPNI] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRcostPNI] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRteamLeaderApprovalPNI] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [SRmanagerApprovalPNI] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

     

  • "

    Anyway, I have the creation scripts. But I'm not sure where to find the relations. The only way that the tables relate to each other is that they all come from the same form. And the first column of each table is the same in each table.

    That's why I was asking how would I do a SELECT statement for all the tables, where the UniqueId of each table was the same. "

    Come again????????????

    You need to follow a course in programming, you're way too far over your head to even complete this project.

  • But Remi, I'm sooooooo close!  With your invaluable guidance of course!

    I think I will take advantage of free tutition and take some VB/SQL courses in the fall!

     

Viewing 15 posts - 136 through 150 (of 167 total)

You must be logged in to reply to this topic. Login to reply