Skip to content
Advertisement

Tag: stored-procedures

Does Mysql have an equivalent to @@ROWCOUNT like in mssql?

How can I get row count values in MySQL as @@ROWCOUNT does in mssql? Answer For SELECTs you can use the FOUND_ROWS construct (documented here): which will return the number of rows in the last SELECT query (or if the first query has a LIMIT clause, it returns the number of rows there would’ve been without the LIMIT). For UPDATE/DELETE/INSERT,

Dynamic order direction

I writing a SP that accepts as parameters column to sort and direction. I don’t want to use dynamic SQL. The problem is with setting the direction parameter. This is the partial code: Answer You could have two near-identical ORDER BY items, one ASC and one DESC, and extend your CASE statement to make one or other of them always

Advertisement