1 Replies - 679 Views - Last Post: 12 September 2012 - 02:44 PM

#1 FroColin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 24-August 12

Convert a column to a different datatype in select statement

Posted 12 September 2012 - 02:41 PM

I need to convert the datatype of a column that is put into a vb.net dataset. I don't want to alter the original table, I want to send a SQL call that populates a dataset and I want one of the columns to be a string, not an int16 so I can add leading zeros, but I can't figure it out! I've been looking it up and found something like this

where CAST(employees AS varchar(4)")


But that just doesn't work at all, maybe I've got the name of the column wrong but I don't think so. What is the name of the column? If I put a "as so and so, " is the column name so and so? With spaces?
Anyway, help would be greatly appreciated

Is This A Good Question/Topic? 0
  • +

Replies To: Convert a column to a different datatype in select statement

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9059
  • View blog
  • Posts: 34,015
  • Joined: 12-June 08

Re: Convert a column to a different datatype in select statement

Posted 12 September 2012 - 02:44 PM

Please do not create duplicate topics. closing..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1