How to put CREATE TRIGGER into TRY-CATCH block with TRANSACTION? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!SET NOCOUNT ON usageWhy should I not wrap every block in “try”-“catch”?Try-catch speeding up my code?T-SQL try … catch and multiple batches (2 begin…end, if…else)SQL transaction in try… catch will not roll backHow to use SQL Server Transaction inside T-SQL TRY…CATCH blockCreate a procedure in a SQL Server transactionTransaction try/catch block - necessary or not?Why CATCH block allows the transaction to commit in SQL Server 2012SQL Server does not rollback trigger transaction to savepoint

Why shouldn't this prove the Prime Number Theorem?

What would you call this weird metallic apparatus that allows you to lift people?

What order were files/directories output in dir?

If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?

Co-worker has annoying ringtone

How were pictures turned from film to a big picture in a picture frame before digital scanning?

The test team as an enemy of development? And how can this be avoided?

Random body shuffle every night—can we still function?

Sally's older brother

My mentor says to set image to Fine instead of RAW — how is this different from JPG?

What is the role of と after a noun when it doesn't appear to count or list anything?

I can't produce songs

One-one communication

Is multiple magic items in one inherently imbalanced?

i2c bus hangs in master RPi access to MSP430G uC ~1 in 1000 accesses

Can humans save crash-landed aliens?

How to ask rejected full-time candidates to apply to teach individual courses?

Why complex landing gears are used instead of simple,reliability and light weight muscle wire or shape memory alloys?

Can two people see the same photon?

What is a more techy Technical Writer job title that isn't cutesy or confusing?

Mounting TV on a weird wall that has some material between the drywall and stud

Special flights

Is there any word for a place full of confusion?

How much damage would a cupful of neutron star matter do to the Earth?



How to put CREATE TRIGGER into TRY-CATCH block with TRANSACTION?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!SET NOCOUNT ON usageWhy should I not wrap every block in “try”-“catch”?Try-catch speeding up my code?T-SQL try … catch and multiple batches (2 begin…end, if…else)SQL transaction in try… catch will not roll backHow to use SQL Server Transaction inside T-SQL TRY…CATCH blockCreate a procedure in a SQL Server transactionTransaction try/catch block - necessary or not?Why CATCH block allows the transaction to commit in SQL Server 2012SQL Server does not rollback trigger transaction to savepoint



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm not advanced programmer in SQL and maybe my question is silly, but I haven't found an answer in google. We have some SQL construction for implementing packages of changes:



...
BEGIN TRY
BEGIN TRANSACTION;
<User Code Is Here>
...
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
...
END CATCH;
...


How can I put the chain of CREATE TRIGGER blocks instead of <User Code Is Here> without errors:



-- Table1
CREATE TRIGGER trTable1_Dates ON dbo.Table1
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END
GO
...
-- TableN
CREATE TRIGGER trTableN_Dates ON dbo.TableN
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END
GO


The purpose is to create all triggers or nothing and print message in CATCH block of code if fails.



Edited



The errors are:



  1. On first trigger's BEGIN: SQL80001: Incorrect syntax near 'BEGIN'. Expecting EXTERNAL.

  2. After first trigger, on GO: SQL80001: Incorrect syntax near 'GO'.


  3. END TRY: SQL80001: Incorrect syntax near 'TRY'. Expecting CONVERSATION.


  4. END CATCH: SQL80001: Incorrect syntax near 'CATCH'. Expecting CONVERSATION.









share|improve this question
























  • Doesnt it work if you just add all the create... scripts at the place of <user code is here>?

    – George Menoutis
    Mar 22 at 12:13











  • @GeorgeMenoutis No, it doesn't. I'll write an errors in Edited section

    – Vitaliy
    Mar 22 at 12:17











  • What platform and version are you using? I haven't seen this kind of errors on sql server...

    – George Menoutis
    Mar 22 at 12:31











  • Visual Studio 2017 (v 15.9.9) or SSMS v 17.9 - there are errors in both environments

    – Vitaliy
    Mar 22 at 12:44

















0















I'm not advanced programmer in SQL and maybe my question is silly, but I haven't found an answer in google. We have some SQL construction for implementing packages of changes:



...
BEGIN TRY
BEGIN TRANSACTION;
<User Code Is Here>
...
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
...
END CATCH;
...


How can I put the chain of CREATE TRIGGER blocks instead of <User Code Is Here> without errors:



-- Table1
CREATE TRIGGER trTable1_Dates ON dbo.Table1
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END
GO
...
-- TableN
CREATE TRIGGER trTableN_Dates ON dbo.TableN
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END
GO


The purpose is to create all triggers or nothing and print message in CATCH block of code if fails.



Edited



The errors are:



  1. On first trigger's BEGIN: SQL80001: Incorrect syntax near 'BEGIN'. Expecting EXTERNAL.

  2. After first trigger, on GO: SQL80001: Incorrect syntax near 'GO'.


  3. END TRY: SQL80001: Incorrect syntax near 'TRY'. Expecting CONVERSATION.


  4. END CATCH: SQL80001: Incorrect syntax near 'CATCH'. Expecting CONVERSATION.









share|improve this question
























  • Doesnt it work if you just add all the create... scripts at the place of <user code is here>?

    – George Menoutis
    Mar 22 at 12:13











  • @GeorgeMenoutis No, it doesn't. I'll write an errors in Edited section

    – Vitaliy
    Mar 22 at 12:17











  • What platform and version are you using? I haven't seen this kind of errors on sql server...

    – George Menoutis
    Mar 22 at 12:31











  • Visual Studio 2017 (v 15.9.9) or SSMS v 17.9 - there are errors in both environments

    – Vitaliy
    Mar 22 at 12:44













0












0








0








I'm not advanced programmer in SQL and maybe my question is silly, but I haven't found an answer in google. We have some SQL construction for implementing packages of changes:



...
BEGIN TRY
BEGIN TRANSACTION;
<User Code Is Here>
...
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
...
END CATCH;
...


How can I put the chain of CREATE TRIGGER blocks instead of <User Code Is Here> without errors:



-- Table1
CREATE TRIGGER trTable1_Dates ON dbo.Table1
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END
GO
...
-- TableN
CREATE TRIGGER trTableN_Dates ON dbo.TableN
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END
GO


The purpose is to create all triggers or nothing and print message in CATCH block of code if fails.



Edited



The errors are:



  1. On first trigger's BEGIN: SQL80001: Incorrect syntax near 'BEGIN'. Expecting EXTERNAL.

  2. After first trigger, on GO: SQL80001: Incorrect syntax near 'GO'.


  3. END TRY: SQL80001: Incorrect syntax near 'TRY'. Expecting CONVERSATION.


  4. END CATCH: SQL80001: Incorrect syntax near 'CATCH'. Expecting CONVERSATION.









share|improve this question
















I'm not advanced programmer in SQL and maybe my question is silly, but I haven't found an answer in google. We have some SQL construction for implementing packages of changes:



...
BEGIN TRY
BEGIN TRANSACTION;
<User Code Is Here>
...
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
...
END CATCH;
...


How can I put the chain of CREATE TRIGGER blocks instead of <User Code Is Here> without errors:



-- Table1
CREATE TRIGGER trTable1_Dates ON dbo.Table1
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END
GO
...
-- TableN
CREATE TRIGGER trTableN_Dates ON dbo.TableN
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END
GO


The purpose is to create all triggers or nothing and print message in CATCH block of code if fails.



Edited



The errors are:



  1. On first trigger's BEGIN: SQL80001: Incorrect syntax near 'BEGIN'. Expecting EXTERNAL.

  2. After first trigger, on GO: SQL80001: Incorrect syntax near 'GO'.


  3. END TRY: SQL80001: Incorrect syntax near 'TRY'. Expecting CONVERSATION.


  4. END CATCH: SQL80001: Incorrect syntax near 'CATCH'. Expecting CONVERSATION.






sql-server tsql transactions try-catch database-trigger






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 13:14









George Menoutis

3,210621




3,210621










asked Mar 22 at 11:59









VitaliyVitaliy

9511




9511












  • Doesnt it work if you just add all the create... scripts at the place of <user code is here>?

    – George Menoutis
    Mar 22 at 12:13











  • @GeorgeMenoutis No, it doesn't. I'll write an errors in Edited section

    – Vitaliy
    Mar 22 at 12:17











  • What platform and version are you using? I haven't seen this kind of errors on sql server...

    – George Menoutis
    Mar 22 at 12:31











  • Visual Studio 2017 (v 15.9.9) or SSMS v 17.9 - there are errors in both environments

    – Vitaliy
    Mar 22 at 12:44

















  • Doesnt it work if you just add all the create... scripts at the place of <user code is here>?

    – George Menoutis
    Mar 22 at 12:13











  • @GeorgeMenoutis No, it doesn't. I'll write an errors in Edited section

    – Vitaliy
    Mar 22 at 12:17











  • What platform and version are you using? I haven't seen this kind of errors on sql server...

    – George Menoutis
    Mar 22 at 12:31











  • Visual Studio 2017 (v 15.9.9) or SSMS v 17.9 - there are errors in both environments

    – Vitaliy
    Mar 22 at 12:44
















Doesnt it work if you just add all the create... scripts at the place of <user code is here>?

– George Menoutis
Mar 22 at 12:13





Doesnt it work if you just add all the create... scripts at the place of <user code is here>?

– George Menoutis
Mar 22 at 12:13













@GeorgeMenoutis No, it doesn't. I'll write an errors in Edited section

– Vitaliy
Mar 22 at 12:17





@GeorgeMenoutis No, it doesn't. I'll write an errors in Edited section

– Vitaliy
Mar 22 at 12:17













What platform and version are you using? I haven't seen this kind of errors on sql server...

– George Menoutis
Mar 22 at 12:31





What platform and version are you using? I haven't seen this kind of errors on sql server...

– George Menoutis
Mar 22 at 12:31













Visual Studio 2017 (v 15.9.9) or SSMS v 17.9 - there are errors in both environments

– Vitaliy
Mar 22 at 12:44





Visual Studio 2017 (v 15.9.9) or SSMS v 17.9 - there are errors in both environments

– Vitaliy
Mar 22 at 12:44












1 Answer
1






active

oldest

votes


















3














You need to run each create table statement in a separate scope/batch (because it has to be the first statement in the batch). So you'll have to escape any quotes in the trigger definitions too:



BEGIN TRY
BEGIN TRANSACTION;
exec sp_executesql N'CREATE TRIGGER trTable1_Dates ON dbo.Table1
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
//An empty string in here has to be '''' to escape the quotes
SET NOCOUNT OFF;
END'

exec sp_executesql N'CREATE TRIGGER trTableN_Dates ON dbo.TableN
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END'
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
...
END CATCH;


Transactions are orthogonal to batches and nested scopes, so the transaction covers all activity that occurs inside each EXEC too.






share|improve this answer























  • Damien, why does putting 'GO' between the trigger creation queries not work? Strangely, I get Incorrect syntax near the keyword 'TRIGGER', but the second(!!) trigger gets created.

    – George Menoutis
    Mar 22 at 13:21







  • 2





    @GeorgeMenoutis - Because GO isn't a T-SQL construct - it tells client tools how to break a script apart into batches to submit to the server. TRY/CATCH blocks can't cross batch boundaries. Your second batch (after the GO) starts with CREATE TRIGGER so the trigger gets created.

    – Damien_The_Unbeliever
    Mar 22 at 13:23












  • Thank you very much. It finally works!

    – Vitaliy
    Mar 22 at 14:08











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55299169%2fhow-to-put-create-trigger-into-try-catch-block-with-transaction%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














You need to run each create table statement in a separate scope/batch (because it has to be the first statement in the batch). So you'll have to escape any quotes in the trigger definitions too:



BEGIN TRY
BEGIN TRANSACTION;
exec sp_executesql N'CREATE TRIGGER trTable1_Dates ON dbo.Table1
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
//An empty string in here has to be '''' to escape the quotes
SET NOCOUNT OFF;
END'

exec sp_executesql N'CREATE TRIGGER trTableN_Dates ON dbo.TableN
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END'
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
...
END CATCH;


Transactions are orthogonal to batches and nested scopes, so the transaction covers all activity that occurs inside each EXEC too.






share|improve this answer























  • Damien, why does putting 'GO' between the trigger creation queries not work? Strangely, I get Incorrect syntax near the keyword 'TRIGGER', but the second(!!) trigger gets created.

    – George Menoutis
    Mar 22 at 13:21







  • 2





    @GeorgeMenoutis - Because GO isn't a T-SQL construct - it tells client tools how to break a script apart into batches to submit to the server. TRY/CATCH blocks can't cross batch boundaries. Your second batch (after the GO) starts with CREATE TRIGGER so the trigger gets created.

    – Damien_The_Unbeliever
    Mar 22 at 13:23












  • Thank you very much. It finally works!

    – Vitaliy
    Mar 22 at 14:08















3














You need to run each create table statement in a separate scope/batch (because it has to be the first statement in the batch). So you'll have to escape any quotes in the trigger definitions too:



BEGIN TRY
BEGIN TRANSACTION;
exec sp_executesql N'CREATE TRIGGER trTable1_Dates ON dbo.Table1
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
//An empty string in here has to be '''' to escape the quotes
SET NOCOUNT OFF;
END'

exec sp_executesql N'CREATE TRIGGER trTableN_Dates ON dbo.TableN
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END'
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
...
END CATCH;


Transactions are orthogonal to batches and nested scopes, so the transaction covers all activity that occurs inside each EXEC too.






share|improve this answer























  • Damien, why does putting 'GO' between the trigger creation queries not work? Strangely, I get Incorrect syntax near the keyword 'TRIGGER', but the second(!!) trigger gets created.

    – George Menoutis
    Mar 22 at 13:21







  • 2





    @GeorgeMenoutis - Because GO isn't a T-SQL construct - it tells client tools how to break a script apart into batches to submit to the server. TRY/CATCH blocks can't cross batch boundaries. Your second batch (after the GO) starts with CREATE TRIGGER so the trigger gets created.

    – Damien_The_Unbeliever
    Mar 22 at 13:23












  • Thank you very much. It finally works!

    – Vitaliy
    Mar 22 at 14:08













3












3








3







You need to run each create table statement in a separate scope/batch (because it has to be the first statement in the batch). So you'll have to escape any quotes in the trigger definitions too:



BEGIN TRY
BEGIN TRANSACTION;
exec sp_executesql N'CREATE TRIGGER trTable1_Dates ON dbo.Table1
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
//An empty string in here has to be '''' to escape the quotes
SET NOCOUNT OFF;
END'

exec sp_executesql N'CREATE TRIGGER trTableN_Dates ON dbo.TableN
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END'
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
...
END CATCH;


Transactions are orthogonal to batches and nested scopes, so the transaction covers all activity that occurs inside each EXEC too.






share|improve this answer













You need to run each create table statement in a separate scope/batch (because it has to be the first statement in the batch). So you'll have to escape any quotes in the trigger definitions too:



BEGIN TRY
BEGIN TRANSACTION;
exec sp_executesql N'CREATE TRIGGER trTable1_Dates ON dbo.Table1
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
//An empty string in here has to be '''' to escape the quotes
SET NOCOUNT OFF;
END'

exec sp_executesql N'CREATE TRIGGER trTableN_Dates ON dbo.TableN
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON;
...
SET NOCOUNT OFF;
END'
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
...
END CATCH;


Transactions are orthogonal to batches and nested scopes, so the transaction covers all activity that occurs inside each EXEC too.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 22 at 13:20









Damien_The_UnbelieverDamien_The_Unbeliever

199k17256348




199k17256348












  • Damien, why does putting 'GO' between the trigger creation queries not work? Strangely, I get Incorrect syntax near the keyword 'TRIGGER', but the second(!!) trigger gets created.

    – George Menoutis
    Mar 22 at 13:21







  • 2





    @GeorgeMenoutis - Because GO isn't a T-SQL construct - it tells client tools how to break a script apart into batches to submit to the server. TRY/CATCH blocks can't cross batch boundaries. Your second batch (after the GO) starts with CREATE TRIGGER so the trigger gets created.

    – Damien_The_Unbeliever
    Mar 22 at 13:23












  • Thank you very much. It finally works!

    – Vitaliy
    Mar 22 at 14:08

















  • Damien, why does putting 'GO' between the trigger creation queries not work? Strangely, I get Incorrect syntax near the keyword 'TRIGGER', but the second(!!) trigger gets created.

    – George Menoutis
    Mar 22 at 13:21







  • 2





    @GeorgeMenoutis - Because GO isn't a T-SQL construct - it tells client tools how to break a script apart into batches to submit to the server. TRY/CATCH blocks can't cross batch boundaries. Your second batch (after the GO) starts with CREATE TRIGGER so the trigger gets created.

    – Damien_The_Unbeliever
    Mar 22 at 13:23












  • Thank you very much. It finally works!

    – Vitaliy
    Mar 22 at 14:08
















Damien, why does putting 'GO' between the trigger creation queries not work? Strangely, I get Incorrect syntax near the keyword 'TRIGGER', but the second(!!) trigger gets created.

– George Menoutis
Mar 22 at 13:21






Damien, why does putting 'GO' between the trigger creation queries not work? Strangely, I get Incorrect syntax near the keyword 'TRIGGER', but the second(!!) trigger gets created.

– George Menoutis
Mar 22 at 13:21





2




2





@GeorgeMenoutis - Because GO isn't a T-SQL construct - it tells client tools how to break a script apart into batches to submit to the server. TRY/CATCH blocks can't cross batch boundaries. Your second batch (after the GO) starts with CREATE TRIGGER so the trigger gets created.

– Damien_The_Unbeliever
Mar 22 at 13:23






@GeorgeMenoutis - Because GO isn't a T-SQL construct - it tells client tools how to break a script apart into batches to submit to the server. TRY/CATCH blocks can't cross batch boundaries. Your second batch (after the GO) starts with CREATE TRIGGER so the trigger gets created.

– Damien_The_Unbeliever
Mar 22 at 13:23














Thank you very much. It finally works!

– Vitaliy
Mar 22 at 14:08





Thank you very much. It finally works!

– Vitaliy
Mar 22 at 14:08



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55299169%2fhow-to-put-create-trigger-into-try-catch-block-with-transaction%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript