"select data from db.datavalues" results "2" instead of "2\2"

As stated in topic, I have a brief notion that I somehow should change the datatype or something to be able to show the missing "\2" to the result.

What is causing the select to remove the last two?

Regards Emanuel

What was the method you used to determine that the data in the table/view is indeed "2\2"?

If the column named "data" is of a string data type (varchar, nvarchar etc.), then when you do the select,it should return "2\2", which is a string. On the other hand, if it is a numeric type (INT, DECIMAL etc.), you will not be able to store a string such as "2\2" in there to start with. You can open up SSMS object explorer, navigate to the table name and look under columns to see what the data type is.

By the way, I am assuming that you meat dbo.datavalues rather than db.datavalues?

Hello James,

Well I'm just showing all data inside the table with SSMS for 2008 R2 by select top 1000 rows on the actual table.
By db.datavalues I'm just calling the database "db" that has the table "datavalues" inside. Sorry for the bad chosen word. : )

Well. The case is I have a software that uses the database for storage of image information and it shows in fact the value "2\2" or "1\1" or "1\2" in a software using it. (The data column is representing pixel size for this specific image and I just want to pick out the column data for further use.)

Datatype is VARCHAR

So.. The software is showing the data correct and the SSMS is showing only the fist digit.
I can manipulate the data from the software to see that the fist digit is changing inside correct column.

Could this be because I'm using SSMS 2008R2 on a SQL2014R2 server?
Will test to install same software on SQL2008R2 server and the do the same select on that.

Any ideas appreciated.

/Emanuel

What does the code look like?

Hello djj55,
Well I don't know the "code" of the software.

What I know is that the software uses an database to store information regarding the images and that I'm able to pick out pixelsize-data and store this into an column.

The software itself shows correct value (eg 2\2) but when using select * of the table the column only states 2.

If I change the value 2\2 to 2\24 from the software I still have 2 from SSMS.
If I then change the value from software to 2-24 (Just exchange backslash to -) it shows up completely as 2-24 in SMSS.

Will try to exchange the backslash before insert instead and see if that would work. But would be interesting to know why and how I could make it work as is.

/Emanuel

That is the code I was talking about.
That said, I do not know why the backslash acts that way.

Is it possible you are selecting from a VIEW which in some way truncates / manipulates the underlying column - and in doing so is altering the data that is presented?

sp_help 'TableOrViewName'

will tell you (column 2 I think :smile:) whether it is a table or a view.