problem with sql table updation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chamarajanaka
    New Member
    • Jul 2010
    • 9

    problem with sql table updation

    I have 2 tables
    Code:
    CREATE TABLE PODRAS_MS.tbl_FieldWorkers
    (
        [FWInsOnServerID]   INT             NOT NULL IDENTITY(1,1),
        [BaseStationID]     INT             NOT NULL,
        [RefID]         INT                     NOT NULL,
        [DisSubInsID]       INT             NOT NULL,   
        [FieldWorkerID]     CHAR(7)                 NOT NULL,
        [LastRecDate]       DATETIME                NOT NULL,
    )
    ALTER TABLE PODRAS_MS.tbl_FieldWorkers ADD CONSTRAINT PK_FieldWorkers_FWInsOnServerID PRIMARY KEY([FWInsOnServerID])
    ALTER TABLE PODRAS_MS.tbl_FieldWorkers ADD CONSTRAINT FK_FieldWorkers_DisSubInsID FOREIGN KEY([DisSubInsID]) REFERENCES PODRAS_MS.tbl_DisasterSubInstances([SubInsID]) ON UPDATE CASCADE ON DELETE NO ACTION
    ALTER TABLE PODRAS_MS.tbl_FieldWorkers ADD CONSTRAINT FK_FieldWorkers_BaseStationID FOREIGN KEY([BaseStationID]) REFERENCES PODRAS_MS.tbl_BaseStations([BaseStationID]) ON UPDATE CASCADE ON DELETE NO ACTION
    ALTER TABLE PODRAS_MS.tbl_FieldWorkers ADD CONSTRAINT DF_FieldWorkers_LastRecDate DEFAULT(GETDATE()) FOR [LastRecDate]
    GO
    
    CREATE TABLE PODRAS_MS.tbl_FieldWorkerNodeGPSLocations
    (
        [FWNStatID]         INT         NOT NULL IDENTITY(1,1),
        [FWInsOnServerID]           INT         NOT NULL,
        [Latitude]          DECIMAL(20,17)          NOT NULL,
        [Longitude]         DECIMAL(20,17)          NOT NULL,
        [UpdateOn]          DATETIME        NOT NULL,
    )
    ALTER TABLE PODRAS_MS.tbl_FieldWorkerNodeGPSLocations ADD CONSTRAINT PK_FieldWorkerNodeGPSLocations_FWNStatID PRIMARY KEY([FWNStatID])
    ALTER TABLE PODRAS_MS.tbl_FieldWorkerNodeGPSLocations ADD CONSTRAINT FK_FieldWorkerNodeGPSLocations_FWInsOnServerID FOREIGN KEY([FWInsOnServerID]) REFERENCES PODRAS_MS.tbl_FieldWorkers([FWInsOnServerID]) ON UPDATE CASCADE ON DELETE NO ACTION
    ALTER TABLE PODRAS_MS.tbl_FieldWorkerNodeGPSLocations ADD CONSTRAINT DK_FieldWorkerNodeGPSLocations_UpdateOn DEFAULT(GETDATE()) FOR [UpdateOn]
    GO
    Both tables are updated through a webservice in the 1st table all the fields can be inserted through the web service but in the second table only data for [Latitude],[Longitude],[UpdateOn] fields comes through the webservice.so my problem is how can i insert the values to [FWInsOnServerID] field since its not comes through the webservice and its a reference for the 1st table???
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32668

    #2
    I would suggest this is a question related to your webservice rather than SQL.

    If you let me know what you're using I can move the thread to the appropriate forum for you.

    Comment

    Working...