can I use 'show SQL query' from crystal report and use in SQL server - sql

I got some crystal reports, these are developed by someone but now I am migrating to SSRS. So when i go to 'show SQL query' from crystal reports it is showing some query but i can't understand properly where these columns coming from. Is there anyway to know exact SQL query so that i can use it in sql server to generate data sets for SSRS.
thanks

You can run Sql Profiler against your database server to see the exact Sql that Crystal Reports is running to generate the report.
Sql Profiler is a tool that comes with Sql Server (under Performance Tools in your Sql Server programs) that shows every Sql statement hitting the database. Run a trace on your Sql Server through Sql Profiler then run your report and Sql Profiler will show you the exact Sql statements that your Crystal report is running against the database.

One option would be split the query manully and see the select and where clause using or if you have access to database run the query over the database to check what all columns it is returning

Related

Output DAX Evaluate results to a SQL Server Database table

So I have a DAX query that I have built in SSAS. But since my application like DAX, I thought pushing the set of DAX results to a database server table would be the ideal solution for my application to read.
How do I output the contents of a DAX query to a SQL Server database table? And if possible truncate the contents of the table before each run?
I'm using SQL Server 2016 if that helps.
I got around this by using a linked server to output the contents of an 'open query' to a table variable in SQL.

Add exsiting query to report

My report calculates the stock of inks in my stores. I built a SQL statement in VB.NET and got the correct results. How can I display these results in my Crystal Report? Or design a report such that same results will be retrieved?
I tried to use SQL Expression builder but failed.
Usually you will link Data Tables to your report using Database Expert. Do the same in Database Expert, select the Database and you can see Add Command. Select that and click the > button. You will get a Window, write your SQL Query there and press OK.
After finishing this you can see Command in Database Fields which contains all your records got from the SQL Query as result.
In Database Manager choose Add Command and then type your SQL Statement there.

Parsing queries in Oracle SQL Developer

Is there a way to parse code in SQL Developer (oracle) without actually touching tables/packages data like you can do with "parse" option in SQL Management studio?
There is no option to merely parse the SQL statement to validate the syntax.
You could choose the "Explain Plan" option (F10 in the Windows version of SQL Developer), that will validate the syntax as part of generating the query plan. If there is a syntax error, you'll get the error message when you attempt to generate the plan but you generally won't get the line and column of the error which makes debugging more challenging.
I was looking for this right now and couldn't find an option in Oracle SQL Developer.
I know a service called SQL Fiddle that can help in such situations where one needs to test/parse/validate an adhoc PL/SQL script. Using SQL Fiddle you can do this:
Select Oracle 11g R2 (as available right now) in the dropdown and type your script in the left text area. Press Build Schema button. If your script is valid then it'll show you Schema Ready message like this:

How can I write a message to SQL profiler from Sql a query?

I am troubleshooting for some SQL issue and I use SQL Profiler in order to diagnose some problem.
Is it possible to write some messages into SQL Profiler by adding some lines in a TSQL query?
thanks!
you can do by adding comment to your t-sql
like
-- My message
select * from table1
and send all to sql
The Application Name should also be different. For our installation, activity on the website gives an application name of ".Net SqlClient Data Provider", while queries from SQL Server Management Studio are designated as... well... "SQL Server Management Studio"

Performance discrepancy in SQL Server Profiler between web query and the same query ran in SSMS

I have a query that takes ~20x as long for SQL server to execute when it comes from a web request, as it does from when the exact same query is ran via SQL Server Management Studio
The following screenshot is from the SQL Server Profiler. The first two records relate to the receipt and execution of query that's come in via the web request, whilst the third record is the exact same query run from SSMS. Why would there be a such a huge difference between the two?
A point: The query is generated from LINQ. I took a copy of the generated SQL and ran it in SSMS to get these results.
ARITHABORT is ON by default in SSMS and OFF by default for a SqlClient connection.
See if this solves your issue:
new SqlCommand("SET ARITHABORT ON", connection).ExecuteNonQuery();