SQL learning record

xiaoxiao2021-03-05  26

1. Search all the same names in the unified field Record Select Loginid from SystemUsers Group By Loginid Having Count (Loginid)> 12. Data Trigger Application: Insert> When the data is empty (NULL) transitions to the same column Mid maximum value plus 1 Create Trigger Test_Insert

ON DBO._OA_HJXM

INSTEAD OF INSERT

AS

Begin

INSERT INTO_HJXM (Creater, Createtime, Shareflag, Deleted, Flowstatus, Endflag, SystemText, Serialno, HJYear, Projname, Hjlevel, Memo, Unit, Member, Depart, Projtype, Photo, Number

Select Creater, Createtime, Shareflag, Deleted, Flowstatus, Endflag, Systemtext, Serialno, HJYear, Projname, Hjlevel, Memo, Unit, Member, Depart, Projtype, Photo,

Case When NumBer is NULL

THEN (select isnull (count (*), 0) 1 from _oa_hjxm)

2.Then (SELECT ISNULL (Max (Number), 0) 1 from _oa_hjxm)

ELSE NUMBER

end

From inserated

end

ON DBO._OA_HJXM

INSTEAD OF INSERT

AS

Begin

INSERT INTO_HJXM (Creater, Createtime, Shareflag, Deleted, Flowstatus, Endflag, SystemText, Serialno, HJYear, Projname, Hjlevel, Memo, Unit, Member, Depart, Projtype, Photo, Number

Select Creater, Createtime, Shareflag, Deleted, Flowstatus, Endflag, Systemtext, Serialno, HJYear, Projname, Hjlevel, Memo, Unit, Member, Depart, Projtype, Photo,

Case When NumBer is NULL

THEN (select isnull (count (*), 0) 1 from _oa_hjxm)

2.Then (SELECT ISNULL (Max (Number), 0) 1 from _oa_hjxm)

ELSE NUMBER

end

From inserated

end

转载请注明原文地址:https://www.9cbs.com/read-33055.html

New Post(0)