Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create empty column in results
Message
 
 
To
13/06/2008 10:44:53
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01323801
Message ID:
01323841
Views:
14
Also perhaps there is a SQL Server function that adds double quote, I just don't recall.

Not sure why do you need to add " in front and perhaps it would be easier to do some extra processing in VFP after you get results, but here I see problems

'"' + cast('' as varchar(12)) WorkPhone + '"' AS WorkPhone,

should be

'"' + cast('' as varchar(12)) + '"' AS WorkPhone,
(and I guess you need to use char(12) and not varchar)

You have same problems in other fields bellow.

>>>>Jay - are you trying to do a select or create a table - I'm assuming you are creating a table..?
>>>
>>>Select.
>>
>>Is your SQL Server case-sensitive? Try with CAST in upper case then or show the whole select statement, it would be easier to see the error.
>
>Error:
>
>
>Msg 102, Level 15, State 1, Line 13
>Incorrect syntax near '+'.
>
>
>SQL (line 13 is the SSN):
>
>
>USE IMPACTMD
>GO
>
>SELECT
>	'"' + LastName + '"' AS LastName,
>	'"' + FirstName + '"' AS FirstName,
>	'"' + MI + '"' AS MI,
>	'"' + Address1 + '"' AS Address1,
>	'"' + Address2 + '"' AS Address2,
>	'"' + City + '"' AS City,
>	'"' + State + '"' AS State,
>	'"' + Zip + '"' AS Zip,
>	'"' + SSN + '"' AS SSN,
>	'"' + Phone + '"' AS Phone,
>	'"' + cast('' as varchar(12)) WorkPhone + '"' AS WorkPhone,
>	'"' + DOB + '"' AS DOB,
>	'"' + Sex + '"' AS Sex,
>	'"' + InsCompanyID + '"' AS InsCompanyID,
>	'"' + InsCompanyID2 + '"' AS InsCompanyID2,
>	'"' + cast('' as varchar(12)) Reserved01 + '"' AS Reserved01,
>	'"' + cast('' as varchar(12)) Reserved02 + '"' AS Reserved02,
>	'"' + cast('' as varchar(12)) Reserved03 + '"' AS Reserved03,
>	'"' + cast('Family_Physician_Last_Name' as varchar(30)) Family_Physician_Last_Name + '"' AS Family_Physician_Last_Name,
>	'"' + cast('Family_Physician_First_Name' as varchar(30)) Family_Physician_First_Name + '"' AS Family_Physician_First_Name,
>	'"' + cast('' as varchar(12)) Reserved04 + '"' AS Reserved04,
>	'"' + cast('Referring_Physician_Last_Name' as varchar(30)) Referring_Physician_Last_Name + '"' AS Referring_Physician_Last_Name,
>	'"' + cast('Referring_Physician_First_Name' as varchar(30)) Referring_Physician_First_Name + '"' AS Referring_Physician_First_Name,
>	'"' + cast('' as varchar(12)) Reserved05 + '"' AS Reserved05,
>	'"' + Provider1 + '"' AS Provider1,
>	'"' + Provider2  + '"' AS Provider2
>	FROM Patients
>
>GO
>
>SET ANSI_PADDING OFF
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform