Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 22nd, 2004, 10:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default CONVERT

Hi there

I'm trying to use the convert function to convert a column of type money to a string but this is the error I get in QA:

Line 2: Incorrect syntax near 'd'.

this is the code I'm using:

SELECT r.Price FROM DVDRegions r, DVDCustomers d
WHERE r.Total = CONVERT(money, d.Price)d.Price

any help would be greatly apprectiated.

Adam

 
Old September 22nd, 2004, 11:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Change
CONVERT(money, d.Price)d.Price
to
CONVERT(money, d.Price)

Also, you could try using an inner join too:

select r.Price from DVDRegions r
inner join DVDCustomers d
on r.Total = convert(money, d.Price)

Brian
 
Old September 23rd, 2004, 03:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

thanks Brian but I get this error when I try and do this:

Implicit conversion from data type varchar to money is not allowed. Use the CONVERT function to run this query.

any ideas.

Adam

 
Old September 23rd, 2004, 07:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

What is the data type for r.Total?

Brian
 
Old September 24th, 2004, 01:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

No worries, you've just jogged my memory! thanks Brian

got it now.

 
Old September 24th, 2004, 10:53 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

What a nice way to make a living, converting varchars to Money..... ;)

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Biscuit by Portishead (Track 9 from the album: Dummy) What's This?




Similar Threads
Thread Thread Starter Forum Replies Last Post
Help to convert c++ to c# happy_face C# 2 November 9th, 2007 10:56 PM
how to convert ???? bobolov Classic ASP Basics 2 June 15th, 2006 12:58 PM
Convert to a number ticktack Classic ASP Basics 4 February 9th, 2004 05:31 AM
convert ngang SQL Server 2000 7 November 21st, 2003 06:03 PM
convert ngang SQL Language 1 November 21st, 2003 05:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.