Skip to content
Advertisement

Tag: database-cursor

SQL Server: log database changes through generic trigger

Starting from this article, which is creating a trigger to log insert-, update- and delete-statements within the database, I’d like to create a similar trigger which doesn’t require to define the table and its columns. This would us to reduce human errors when dropping or adding columns. I’ve had many issues (hence the extra code compared to the article) but

Invalid Column Name using Dynamic SQL

I am attempting to use Dynamic SQL for the 1st time – Now i understand the gist of it to an extent however attempting to enter a parameter into a temp table using Dynamic SQL i am getting the “Invalid Column name” when i am simply try to enter this as text not intending to be a column. On a

SQL Server – Cursor

I am trying to loop through a table using a cursor: That above returns taskResourceOID and EvUserOID. If I need to output a table with the @TaskOID and the respective taskResourceOID and EvUserOID, what is the best way to do it? Answer Use a temporary table or a table variable.. Or even better, don’t use a cursor (this can be

Advertisement