Hi All, In my application many I time we use MAX(). How can I write a common function where I can pass table name and column name and get MAX(). I mean single function for any table/field.
Thanks, Tanmay.
Hi All, In my application many I time we use MAX(). How can I write a common function where I can pass table name and column name and get MAX(). I mean single function for any table/field.
Thanks, Tanmay.
In MSSQL there are no particularly elegant ways to use UDFs with dynamic table/field names, so personally I would just stick to a simple SELECT MAX()
.
If the IDs are IDENTITY
columns you can just use IDENT_CURRENT('the_table')