I have an SQL statement that, when run through SQL Server management studio works fine. However, when I run it on my ASP page, it doesn't update the data! I have tried both as a stored procedure and as a simple commandText update statement.
All I do is simly update the value of a column based on another column – nothing particularly complex:
update customerset dateChanged =System.DateTime.Now.ToString("dd-MMM-yyyy"),CURRSTAT = 'Active',custType = case WHEN cust_Changing_To IS NOT NULL THEN cust_Changing_To ELSE custType END,cust_Changing_To = NULLFROM customers_vWHERE CURRSTAT = 'Changing'
As you can see, nothing that complex. The line that is causing the problem is the case:
custType = case WHEN cust_Changing_To IS NOT NULL THEN cust_Changing_To ELSE custType END
all it does is if another nullable integer column is not null, sets it to the value of that column, else it retains its existing value.
Like I say, this works in Management studio, but I cannot get it to execute programatticaly from an asp page.
No exceptions are being thrown, it just doesn't update the data.
Any ideas?
Thanks
Try running SQL Profiler and see exactly what is being executed against the database.
No comments:
Post a Comment