Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL insert statement needs to run over 100 times

$
0
0

I have a sql insert statement that works but I have over 100set @guidPersonID = '18D6631E-1402-45BB-9197-43CBCF4E3012' that I need to run the statement with.

The full insert statements is below. Greatly appreciate any ideas. If I change the declare variable to@guidPersonID1 and then @guidPersonID2 etc. I can use BEGIN and END but would have to do that over 100 times.

BEGIN
declare @guidPersonID uniqueidentifier
set @guidPersonID = '18D6631E-1402-45BB-9197-43CBCF4E3012'
;

insert into user_person_filter (enterprise_id,practice_id, user_id, person_id, incl_ind, excl_ind, share_ind)

SELECT distinct enterprise_id = '00001'
,practice_id = '0001'
,um.user_id
,person_id = @guidPersonID
-- ,ex.row_timestamp
,incl_ind = 'N'
,excl_ind = 'Y'
,share_ind = 'N'
FROM user_mstr um
join user_group_xref ug on um.user_id = ug.user_id
where...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>