Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 251
  • Last Modified:

Crystal Reports - spaces in columns

Hi -
I am using CR10 and trying to create a report that has spaces in the column name

In CR the sql statement looks something like this

SELECT
table_name1.LastName
,table_name2.User id
FROM table_name1
INNER JOIN table_name2
ON table_name1.id=table_name2.User id

This gives a error in SQL so it should look something like this:
SELECT
table_name1.LastName
,table_name2.[User id]
FROM table_name1
INNER JOIN table_name2
ON table_name1.id=table_name2.[User id]

Is there any way to change this in CR10 so that it sends the proper format to the sql server

Thanks in advance
0
doctor069
Asked:
doctor069
  • 5
  • 5
1 Solution
 
mlmccCommented:
Try this

SELECT
table_name1.LastName
, 'table_name2'.'User id'
FROM table_name1
INNER JOIN table_name2
ON table_name1.id= 'table_name2'.'User id'

mlmcc
0
 
doctor069Author Commented:
thanks mlmcc but how is that done in crystal reports.

I just drop the field onto the report and crystal creates the sql
0
 
mlmccCommented:
Did you select the tables and just putting the fields on the report?
If so, Crystal should add the appropriate deliiters to the SQL.

mlmcc
0
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

 
mlmccCommented:
Is the issue with Crystal or the Export?

What version of Crystal?

mlmcc
0
 
doctor069Author Commented:
Crystal 10
Yes, I select the tables and put the fields on the report.

When I view the SQL (Database -> Show SQL Query) in Crystal it has not added the anything to accommodate for the space.

table_name2.User id needs to be table_name2.[User id]

So I get a SQL error when running the report
0
 
mlmccCommented:
Try a VERIFY DATABASE.

Another idea would be to delete that table from the report then run the report and then add the table back.

mlmcc
0
 
doctor069Author Commented:
Database verify says "Up To Date"

I removed the table, ran report (no issues) then error again when I added.
0
 
mlmccCommented:
No idea.   I generally use fieldnames with no spaces or use underscores for them.

When you select the tables you can't change the SQL that is generated.  Almost sounds like there is a problem with your Crystal install.

Is it a full version of Crystal 10 or one of the versions that came with Visual Studio?

Do you have Visual studio 2003, 2005, or 2008 installed?
If so is Crystal for Visual Studio installed?

mlmcc
0
 
doctor069Author Commented:
Had to change the column names to have no spaces in order for it to work
0
 
doctor069Author Commented:
No answer given
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now