Answer the question
In order to leave comments, you need to log in
Is it possible to write an UPDATE that will update the id values?
There is a query like this:
SELECT SCHED.mList_id, ml.id, MD.mList_id, SM.mList_id
FROM [TEST].[dbo].[PATP_Schedule] AS SCHED
INNER JOIN TEST..PATP_MarshrutList AS ML
ON SCHED.mList_id = ML. id
INNER JOIN TEST..PATP_MarshrutData AS MD
ON MD.mList_id = ML.id
INNER JOIN [TEST].[dbo].[PATP_SubMarshrut] AS SM
ON ML.id = SM.mList_id
prints table ID values. Help write an UPDATE that will update them starting at 2000 for example. Thanks in advance.
Answer the question
In order to leave comments, you need to log in
CTE to help you:
WITH cteName as (
SELECT SCHED.mList_id, ml.id, MD.mList_id, SM.mList_id
FROM [TEST].[dbo].[PATP_Schedule] AS SCHED
INNER JOIN TEST..PATP_MarshrutList AS ML
ON SCHED.mList_id = ML.id
INNER JOIN TEST..PATP_MarshrutData AS MD
ON MD.mList_id = ML.id
INNER JOIN [TEST].[dbo].[PATP_SubMarshrut] AS SM
ON ML.id = SM.mList_id
)
UPDATE cteName set mList_id = <someValue>;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question