“This SqlTransaction has completed; it is no longer usable.”… configuration error?

I believe this error message is due to a “zombie transaction”. Look for possible areas where the transacton is being committed twice (or rolled back twice, or rolled back and committed, etc.). Does the .Net code commit the transaction after the SP has already committed it? Does the .Net code roll it back on encountering … Read more

Creating stored procedure and SQLite?

SQLite has had to sacrifice other characteristics that some people find useful, such as high concurrency, fine-grained access control, a rich set of built-in functions, stored procedures, esoteric SQL language features, XML and/or Java extensions, tera- or peta-byte scalability, and so forth Source : Appropriate Uses For SQLite

Must declare the scalar variable

The reason you are getting the DECLARE error from your dynamic statement is because dynamic statements are handled in separate batches, which boils down to a matter of scope. While there may be a more formal definition of the scopes available in SQL Server, I’ve found it sufficient to generally keep the following three in … Read more

Arithmetic overflow error converting expression to data type datetime. (while displaying date time..)

You issue is that you’re trying to convert the numeric to a datetime, and this just isn’t working. You need to turn your numeric into a string first: SQL Fiddle with demo. When you try and convert a numeric type to a datetime, SQL Server tries to add the numeric value as the number of days to the date 01-Jan-1900. In your … Read more