Sqlserver 插入一条记录时,不重复插入的办法

时间:2022-11-13 00:25:31

阻止插入一条记录时重复插入

Sqlserver 插入一条记录时,不重复插入的办法Sqlserver 插入一条记录时,不重复插入的办法代码
insert   into  
[ Catchpage ] . [ dbo ] . [ gdlmo_yq ] ( [ title ] , [ PageUrl ] )
select   ' aaaa ' , ' http://10.4.19.252 '  

where   not   exists
(
select   *   from   [ Catchpage ] . [ dbo ] . [ gdlmo_yq ]  b  where  b. [ PageUrl ]   =   ' http://10.4.19.252 ' )