I am using a stored procedures to handle some maintainance stuff in my DB, I have a binary field called Container, that for all rows that have that specific container I need to remove the oldest n rows, I also have a time field so I can order by it,
in addition my table is recursive and so if I delete one value I need to delete all it's children.
So in short what I did is create a CTE that selects all the lines that I want to delete, using SELECT TOP @n FROM mytable WHERE
Now I had to use sp_executesql due to using a variable to declare the TOP value, but now it won't let me compare the binary value stating that nvarchar and varbinary data types are incompatible through add operator (I tried to do
How can I do this properly?
View Complete Post