Command Line : Parameters

Discussion of open issues, suggestions and bugs regarding database management and development tools for SQL Server
nusa
Posts: 18
Joined: Thu 02 Feb 2017 16:12

Command Line : Parameters

Post by nusa » Mon 20 Feb 2017 12:42

Hi,
I've a query for a report :

Code: Select all

SELECT
  Ticket.Number
 ,Company.FirmName AS Client
 ,Ticket.Subject AS [Objet de la demande]
 ,[User].Username AS Demandeur
 ,[User].Email
 ,TicketTask.Title AS [Titre tâche]
 ,Ticket.RequestDate AS [Date de la demande]
 ,TicketTask.Logwork AS [Durée de la tâche]
 ,TicketTask.CreationDate AS [Date de la tâche]
 ,User_1.FirstName
 ,User_1.LastName AS [Tech]
 ,TicketTask.Logwork AS timefromparts
 ,CONVERT(TIME(0), DATEADD(SECOND, TicketTask.Logwork, 0)) AS 'hh:mm:ss'
 ,User_1.Id AS [ID Tech]
FROM MembershipManagement.[User]
INNER JOIN OrganizationManagement.Company
  ON [User].CompanyId = Company.Id
INNER JOIN IncidentManagement.Ticket
  ON Ticket.RequesterId = [User].Id
INNER JOIN IncidentManagement.TicketTask
  ON TicketTask.TicketId = Ticket.Id
INNER JOIN MembershipManagement.[User] User_1
  ON TicketTask.AgentId = User_1.Id
WHERE TicketTask.DueDate BETWEEN DATEADD(d, 0, DATEDIFF(d, 0, GETDATE())) AND GETDATE()
AND User_1.Id = @Tech_Id
@Tech_Id is a parameter

On my script, .bat :

Code: Select all

C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /datareport /reportfile:"C:\Reporting\DEV\ChargeTech\Chargetech.rdb" /parameters:Tech_Id="1c4cc27f-232c-4d67-8cef-aff15c7d96aa" /format:pdf /result email:"[email protected]"
If i run manually the query, it's OK :

https://cl.ly/1j1t0i0H1s0H

But whith the script .bat, I've this error :
------ Data report generation started ------


Retrieving data: Failed
Error: An error occurred while retrieving data: La variable scalaire "@Tech_Id"
doit être déclarée.


------ Data report generation finished ------
Nusa

alexa

Re: Command Line : Parameters

Post by alexa » Mon 20 Feb 2017 14:51

Please try replacing @ with : in the SELECT query before the parameter, resave the *.rdb file with the new character and call it from the command line.

nusa
Posts: 18
Joined: Thu 02 Feb 2017 16:12

Re: Command Line : Parameters

Post by nusa » Mon 20 Feb 2017 15:02

Hi,

My code :

Code: Select all

AND User_1.Id = :Tech_Id
But :
https://cl.ly/1O2W2J2i3C3u

And :
------ Data report generation started ------


Retrieving data: Failed
Error: An error occurred while retrieving data: Syntaxe incorrecte vers ':'.


------ Data report generation finished ------
Nusa

alexa

Re: Command Line : Parameters

Post by alexa » Mon 20 Feb 2017 15:35

Thank you for the reply.

Please try the following:

1. Replace it back to:

Code: Select all

@Tech_Id
2. Use the following command line string:

Code: Select all

C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /datareport /reportfile:"C:\Reporting\DEV\ChargeTech\Chargetech.rdb" /parameters Tech_Id:"1c4cc27f-232c-4d67-8cef-aff15c7d96aa" /format:pdf /result email:"[email protected]"

nusa
Posts: 18
Joined: Thu 02 Feb 2017 16:12

Re: Command Line : Parameters

Post by nusa » Mon 20 Feb 2017 15:58

------ Data report generation finished ------


Invalid command line. Parameter name '' is not presented in report query.

Command line usage:

dbforgesql [/argfile:path] [/operation_switch] [/switch1[:value | [parameter1:va
lue parameter2:value ..]] /switch2 ..]

The first argument for dbforgesql is usually an operation switch that correspond
s to operation that you want to perform with the application.
:cry:

nusa

alexa

Re: Command Line : Parameters

Post by alexa » Mon 20 Feb 2017 16:07

Thank you for the reply.

Will it be possible to provide us the *.bat and *.rdb files?

You can send a reply straight to our support system at supportATdevartDOTcom and alexaATdevartDOTcom

nusa
Posts: 18
Joined: Thu 02 Feb 2017 16:12

Re: Command Line : Parameters

Post by nusa » Tue 21 Feb 2017 11:53

Hi,

Mail is sent.

Nusa

alexa

Re: Command Line : Parameters

Post by alexa » Tue 21 Feb 2017 12:28

Thank you for the reply.

Could you please also let us know what version of dbForge Studio for SQL Server you are using?

nusa
Posts: 18
Joined: Thu 02 Feb 2017 16:12

Re: Command Line : Parameters

Post by nusa » Tue 21 Feb 2017 12:32

Pro edition, V 5.4.215

Nusa

nusa
Posts: 18
Joined: Thu 02 Feb 2017 16:12

Re: Command Line : Parameters

Post by nusa » Tue 21 Feb 2017 12:37

Same problem with the 5.4.211

Nusa

alexa

Re: Command Line : Parameters

Post by alexa » Tue 21 Feb 2017 14:23

Thank you for the reply.

Please try the following

Code: Select all

C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /datareport /reportfile:"C:\Reporting\DEV\ChargeTech\Chargetech.rdb" parameters Tech_Id:"1c4cc27f-232c-4d67-8cef-aff15c7d96aa" /format:pdf /result email:"[email protected]"

nusa
Posts: 18
Joined: Thu 02 Feb 2017 16:12

Re: Command Line : Parameters

Post by nusa » Tue 21 Feb 2017 17:46

Same result :
------ Data report generation started ------


Retrieving data: Failed
Error: An error occurred while retrieving data: La variable scalaire "@Tech_Id"
doit être déclarée.


------ Data report generation finished ------

Error: An error occurred while retrieving data: La variable scalaire "@Tech_Id"
doit être déclarée.
Nusa

alexa

Re: Command Line : Parameters

Post by alexa » Wed 22 Feb 2017 14:40

Thank you for the reply.

We will investigate this issue and will answer you as soon as possible.

alexa

Re: Command Line : Parameters

Post by alexa » Thu 23 Feb 2017 10:34

We were able to reproduce this issue and will fix it in the next product build that should be released next week.

The problem, in fact, happens when using the parameters containing upper case characters.

nusa
Posts: 18
Joined: Thu 02 Feb 2017 16:12

Re: Command Line : Parameters

Post by nusa » Thu 23 Feb 2017 10:56

Yes, good news.
It's possible to make a test with beta?

Thank's.

Nusa (I'm in holidays the newt week :-)

Post Reply