SQL: Inserte flere poster samtidig
Her er en måte å inserte flere records i samme insert:
INSERT INTO [Database].[dbo].[StatusType]
([StatusId]
,[HendelseTypeId]
,[Status]
,[LogtilKode]
,[Velgbar]
,[XStatus])
SELECT
15,1,'',1,0,'STARTSAK'
UNION ALL
SELECT
15,2,'',1,0,'STARTSAK'
union all
SELECT
15,3,'',1,0,'STARTSAK'
UNION ALL
SELECT
15,4,'',1,0,'STARTSAK'
UNION ALL
SELECT
15,5,'',1,0,'STARTSAK'
UNION ALL
SELECT
15,6,'',1,0,'STARTSAK'
UNION ALL
([StatusId]
,[HendelseTypeId]
,[Status]
,[LogtilKode]
,[Velgbar]
,[XStatus])
SELECT
15,1,'',1,0,'STARTSAK'
UNION ALL
SELECT
15,2,'',1,0,'STARTSAK'
union all
SELECT
15,3,'',1,0,'STARTSAK'
UNION ALL
SELECT
15,4,'',1,0,'STARTSAK'
UNION ALL
SELECT
15,5,'',1,0,'STARTSAK'
UNION ALL
SELECT
15,6,'',1,0,'STARTSAK'
UNION ALL
SELECT
23,1,'Eierskifte',1,0,'EIERSKIFTE'
UNION ALL
SELECT
23,2,'Eierskifte',1,0,'EIERSKIFTE'
union all
SELECT
23,3,'Eierskifte',1,0,'EIERSKIFTE'
UNION ALL
SELECT
23,4,'Eierskifte',1,0,'EIERSKIFTE'
UNION ALL
SELECT
23,5,'Eierskifte',1,0,'EIERSKIFTE'
UNION ALL
SELECT
23,6,'Eierskifte',1,0,'EIERSKIFTE'
23,1,'Eierskifte',1,0,'EIERSKIFTE'
UNION ALL
SELECT
23,2,'Eierskifte',1,0,'EIERSKIFTE'
union all
SELECT
23,3,'Eierskifte',1,0,'EIERSKIFTE'
UNION ALL
SELECT
23,4,'Eierskifte',1,0,'EIERSKIFTE'
UNION ALL
SELECT
23,5,'Eierskifte',1,0,'EIERSKIFTE'
UNION ALL
SELECT
23,6,'Eierskifte',1,0,'EIERSKIFTE'
union all
SELECT
13,1,'Ok/Lest',1,0,'UNDER_ARBEID'
UNION ALL
SELECT
13,2,'Ok/Lest',1,0,'UNDER_ARBEID'
union all
SELECT
13,3,'Ok/Lest',1,0,'UNDER_ARBEID'
UNION ALL
SELECT
13,4,'Ok/Lest',1,0,'UNDER_ARBEID'
UNION ALL
SELECT
13,5,'Ok/Lest',1,0,'UNDER_ARBEID'
UNION ALL
SELECT
13,6,'Ok/Lest',1,0,'UNDER_ARBEID'
13,1,'Ok/Lest',1,0,'UNDER_ARBEID'
UNION ALL
SELECT
13,2,'Ok/Lest',1,0,'UNDER_ARBEID'
union all
SELECT
13,3,'Ok/Lest',1,0,'UNDER_ARBEID'
UNION ALL
SELECT
13,4,'Ok/Lest',1,0,'UNDER_ARBEID'
UNION ALL
SELECT
13,5,'Ok/Lest',1,0,'UNDER_ARBEID'
UNION ALL
SELECT
13,6,'Ok/Lest',1,0,'UNDER_ARBEID'
GO
Posted by email from Henris blogg (posterous)
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment