Basically, I'm trying to update a date if this function below it is true.
I'm going to use this code in MS Visual Studio to compare it to the index of a checked item in a checked list box...
UPDATE rent
SET dat_vrac = CONVERT(smalldatetime, CURRENT_TIMESTAMP)
(SELECT CAST(rownumber AS VARCHAR)
FROM (SELECT dat_vrac, row_number()
OVER (order by dat_vrac) AS 'rownumber'
FROM rent) TableExpressionsMustHaveAnAliasForDumbReasons
WHERE (
cast (rownumber as varchar)
) > '0')
SqlCommand komanda = new SqlCommand("WITH CTE_RENT AS ( SELECT dat_vrac, ROW_NUMBER() OVER (order by dat_vrac) rn FROM rent) UPDATE CTE_RENT SET dat_vrac = CONVERT(SMALLDATETIME, CURRENT_TIMESTAMP) WHERE rn ='" + chlb_return.Items.Cast<int>() + "'", konekcija);