Print Page | Close Window

Dynamic Sql

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=3896
Printed Date: 02 May 2024 at 3:08am


Topic: Dynamic Sql
Posted By: rajaobj
Subject: Dynamic Sql
Date Posted: 04 Aug 2008 at 11:18pm
Hi,
Can we use dynamic sql in crystal reports.I have written a SP using Dynamic Sql in SQLServer 2005.But when i use the SP inside the report i am not able to see the columns insted i am getting Expr1000,Expr1001,Expr1002.Any suggestions




-------------
Thanks,
Raja



Replies:
Posted By: hilfy
Date Posted: 12 Aug 2008 at 12:48pm
Crystal stores the column names in the report.  For an example of this, build a simple report with a table and then add a field to the table - it won't appear in the field explorer until you specifically validate the database.  So, if the stored procedure can return different column names in different orders, you won't be able to see the actual field names in the report designer.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: cobill
Date Posted: 17 Oct 2008 at 10:27am

I've got a similar problem.  I'm using SQL Server 2000 and Visual Studio 2008 with it's bundled version of Crystal Reports.  I had a report populated by a stored procedure, but changed the stored procedure to use dynamic SQL (only for selection criteria, not for column names).  I can now preview the report from the .rpt tab with no errors, but when the report runs, as soon as the CR viewer loads, I get a pop-up Query Engine Error: '42S02... Invalid object name '.report_vw'  (which is prepended in code with a dynamic database name) Failed to open a rowset.  After clicking OK and putting in the parameters, the report still runs fine.  Any idea how to avoid the pop-up?  Thanks.



-------------
cobill



Print Page | Close Window