I'm currently building an app for my work, it work perfectly on my PC but one i put the compile code on to the 2008 server with sqlserver 2005 and run it i get an sql error truncat data.
The weird part is that it aim the same table in the same database and it try to send to same datas.
Any one has an idea?
Unhandled Exception: System.Data.SqlClient.SqlException: String or binary data w ould be truncated. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolea n breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObj ect stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cm dHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, Tds ParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, Run Behavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBe havior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehav ior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehav ior, RunBehavior runBehavior, Boolean returnStream, String method)
I had to run the remote debugger on the server and the stupid account was 1 char to big for the table login.lenght = 16 table table_login(varchar15)...
Can you give any indication what you are doing at this point? One option would be i18n issues - i.e. does the 2008 server have different regional settings to your machine? this might mean that you are building some TSQL that is different (for example, formatting a date differently), and it no longer fits in the specified field (
varchar(10), for example, will take some date formats but not others). Of course, the real fix here is to use a
datetime - but this is just an example!
I think your best bet comes from doing a sql trace using the sql development tools; this will make it obvious what is actually being sent.
Run the SQL Server Profiler to make sure you are really sending the same data. It should become apparent quite quickly that one of your assumptions is wrong.
Check the default values of table or triggers. For example, inserted user name (suser_name) or host name (host_name) values may vary on different servers. And one of them may be incompatible with field size.
Make sure your table definition ad your stored procedure definitions are the same. I.e
if you declared
varchar(10) the stored procedure should also have the same definition of