Click here to Skip to main content
15,860,859 members
Home / Discussions / Database
   

Database

 
AnswerRe: Need a script, SDF or UDF for checking the following conditions and make IF Else in a stored procedure SQL Server Pin
Richard Deeming21-Jul-20 23:25
mveRichard Deeming21-Jul-20 23:25 
QuestionHow to optimize Hash Match aggregation in SQL Server execution plan Pin
kali siddhu17-Jul-20 0:38
kali siddhu17-Jul-20 0:38 
AnswerRe: How to optimize Hash Match aggregation in SQL Server execution plan Pin
Eddy Vluggen21-Jul-20 10:44
professionalEddy Vluggen21-Jul-20 10:44 
QuestionDead lock issue with Update and delete statement on the same table Pin
kali siddhu14-Jul-20 23:37
kali siddhu14-Jul-20 23:37 
AnswerRe: Dead lock issue with Update and delete statement on the same table Pin
David Mujica15-Jul-20 10:57
David Mujica15-Jul-20 10:57 
GeneralRe: Dead lock issue with Update and delete statement on the same table Pin
kali siddhu15-Jul-20 23:33
kali siddhu15-Jul-20 23:33 
QuestionIs there any alternative for Trigger After Insert Pin
simpledeveloper13-Jul-20 17:56
simpledeveloper13-Jul-20 17:56 
AnswerRe: Is there any alternative for Trigger After Insert Pin
Richard Deeming13-Jul-20 22:35
mveRichard Deeming13-Jul-20 22:35 
Use a computed column:
Specify Computed Columns in a Table - SQL Server | Microsoft Docs[^]

If you want to continue using a trigger, you'll need to update it to account for the fact that a trigger can be fired for multiple rows at the same time:
SQL
CREATE TRIGGER AfterInsert
   ON InspectionItems
   AFTER INSERT
AS 
BEGIN
    SET NOCOUNT ON;
    
    UPDATE
        T
    SET
        InspectionItemNumber = 'T' + RIGHT('00000' + CAST(InspectionItemId AS VARCHAR(5)), 6)
    FROM
        InspectionItems As T
        INNER JOIN inserted As I
        ON I.InspectionItemId = T.InspectionItemId
    ;
END
GO




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Is there any alternative for Trigger After Insert Pin
simpledeveloper14-Jul-20 10:41
simpledeveloper14-Jul-20 10:41 
QuestionConnection Resources Pin
Richard Andrew x6411-Jul-20 13:50
professionalRichard Andrew x6411-Jul-20 13:50 
AnswerRe: Connection Resources Pin
Richard Deeming13-Jul-20 0:04
mveRichard Deeming13-Jul-20 0:04 
QuestionSql server deadlock issue with table bulk insert and update on same table Pin
kali siddhu29-Jun-20 21:18
kali siddhu29-Jun-20 21:18 
AnswerRe: Sql server deadlock issue with table bulk insert and update on same table Pin
Richard MacCutchan29-Jun-20 21:54
mveRichard MacCutchan29-Jun-20 21:54 
GeneralRe: Sql server deadlock issue with table bulk insert and update on same table Pin
kali siddhu30-Jun-20 23:29
kali siddhu30-Jun-20 23:29 
GeneralRe: Sql server deadlock issue with table bulk insert and update on same table Pin
Richard MacCutchan30-Jun-20 23:31
mveRichard MacCutchan30-Jun-20 23:31 
GeneralRe: Sql server deadlock issue with table bulk insert and update on same table Pin
David Mujica1-Jul-20 5:36
David Mujica1-Jul-20 5:36 
GeneralRe: Sql server deadlock issue with table bulk insert and update on same table Pin
kali siddhu15-Jul-20 23:44
kali siddhu15-Jul-20 23:44 
AnswerRe: Sql server deadlock issue with table bulk insert and update on same table Pin
ZurdoDev1-Jul-20 7:03
professionalZurdoDev1-Jul-20 7:03 
QuestionHttp 500 error with register page Pin
and180y29-Jun-20 4:31
and180y29-Jun-20 4:31 
AnswerRe: Http 500 error with register page Pin
ZurdoDev29-Jun-20 4:33
professionalZurdoDev29-Jun-20 4:33 
GeneralRe: Http 500 error with register page Pin
and180y29-Jun-20 4:45
and180y29-Jun-20 4:45 
GeneralRe: Http 500 error with register page Pin
ZurdoDev29-Jun-20 4:49
professionalZurdoDev29-Jun-20 4:49 
AnswerRe: Http 500 error with register page Pin
Richard Deeming29-Jun-20 5:15
mveRichard Deeming29-Jun-20 5:15 
GeneralRe: Http 500 error with register page Pin
and180y29-Jun-20 5:21
and180y29-Jun-20 5:21 
GeneralRe: Http 500 error with register page Pin
and180y29-Jun-20 7:40
and180y29-Jun-20 7:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.