Advertisement

05.29.2008 at 10:49AM PDT, ID: 23442301
[x]
Attachment Details

problem with casting varchar

Asked by attipa in MS SQL Server

Tags: SQL

i can't get this to work:

select cast([Name] + ' ' + cast(NoGuests as int) - 1) as varchar(50))
From GuestList

i am trying to subtract 1 from the NoGuests and then cast the whole thing as a varchar.

Msg 1035, Level 15, State 10, Line 1
Incorrect syntax near 'cast', expected 'AS'.
Start Free Trial
[+][-]05.29.2008 at 10:53AM PDT, ID: 21671566

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: SQL
Sign Up Now!
Solution Provided By: Thomasian
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.29.2008 at 10:53AM PDT, ID: 21671578

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628