1 Replies - 2557 Views - Last Post: 10 September 2012 - 01:47 PM

#1 inkey  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 49
  • Joined: 26-June 12

Cast to varchar sql statement

Posted 06 September 2012 - 01:48 AM

Hi i have the following sql statement that returns all decimals from database.

SELECT * FROM [Product] WHERE [DATE] BETWEEN 'param01' AND 'param02'


How would i change this so that it allows me to cast the decimals to varchar?
Is This A Good Question/Topic? 0
  • +

Replies To: Cast to varchar sql statement

#2 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 800
  • View blog
  • Posts: 1,687
  • Joined: 30-January 09

Re: Cast to varchar sql statement

Posted 10 September 2012 - 01:47 PM

You need to SELECT the columns explicitly, and use the CAST/CONVERT within the SELECT, e.g.-
SELECT
  CONVERT(nvarchar(64), MyColumn) AS MyConvertedColumn
FROM MyTable


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1