SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


convert crystal to SQL


convert crystal to SQL

Author
Message
GG_BI_GG
GG_BI_GG
SSC-Enthusiastic
SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)

Group: General Forum Members
Points: 178 Visits: 258
Hello SQLservercentral members,

How do I translate this crystal report sql in Microsoft sql. The following is the syntax:

if {inc_data.event_type}="c" then "R"+CStr({incident.incident_ref},"####0")
else if {inc_data.event_type}="i" then CStr({incident.incident_ref},"####0")
else "P"+CStr({incident.incident_ref},"####0")
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27119 Visits: 13268
This is not SQL, it is some sort of Visual Basic.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
GG_BI_GG
GG_BI_GG
SSC-Enthusiastic
SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)

Group: General Forum Members
Points: 178 Visits: 258
This is Crystalreport. In crystal report you can use Formula Fields. know i wanne convert it.

When you read the code you can see that the difference is little. I hope you can help me forwards.

(Koen ben je Nederlands?)
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27119 Visits: 13268
So you want to use this formula as a SSRS formula?
In that case, it would be something like this:

iif(Fields!event_type == "c","R" + Format(Fields!event_type,"####0"),iif(Fields!event_type == "i",Format(Fields!event_type,"####0"),"P" + Format(Fields!event_type,"####0"))



Not 100% sure about the format function though, so you better check if it works.

ps: ik ben van België, maar ik spreek Nederlands :-)


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
GG_BI_GG
GG_BI_GG
SSC-Enthusiastic
SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)

Group: General Forum Members
Points: 178 Visits: 258
Koen Verbeeck (8/6/2013)
So you want to use this formula as a SSRS formula?
In that case, it would be something like this:

iif(Fields!event_type == "c","R" + Format(Fields!event_type,"####0"),iif(Fields!event_type == "i",Format(Fields!event_type,"####0"),"P" + Format(Fields!event_type,"####0"))



Not 100% sure about the format function though, so you better check if it works.

ps: ik ben van België, maar ik spreek Nederlands :-)


Ik voegde het in mijn expression bij waar de gegevens aangepast moeten worden alleen het werkt niet... Doe ik iets verkeerd.

look pictures
Attachments
Capture.JPG (18 views, 11.00 KB)
Capture1.JPG (15 views, 21.00 KB)
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27119 Visits: 13268
I'll continue in English for people who accidentilly stumble upon this thread.

You entered the expression in the text field itself, so it is just text, not an expression.
Right click on the text box and select expression from the context menu. Enter your expression there.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
GG_BI_GG
GG_BI_GG
SSC-Enthusiastic
SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)

Group: General Forum Members
Points: 178 Visits: 258
It is in the expression box.

Look picture
Attachments
Capture23.JPG (15 views, 32.00 KB)
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27119 Visits: 13268
Any errors?


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
GG_BI_GG
GG_BI_GG
SSC-Enthusiastic
SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)

Group: General Forum Members
Points: 178 Visits: 258
In the example you see that i must use the = Smile now im use it but.. I get a syntax error..

See picture.
Attachments
Capture4.JPG (64 views, 47.00 KB)
Capture5.JPG (13 views, 16.00 KB)
Eric M Russell
Eric M Russell
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12054 Visits: 10622
I'm not certain what formatting "####0" represents, it could be padding with spaces or zeros, but basically it would be a CASE expression like so:

case inc_data.event_type
when 'c' then 'R'+left('00000'+cast(incident.incident_ref as varchar),5)
when 'i' then left('00000'+cast(incident.incident_ref as varchar),5)
else 'P'+left('00000'+cast(incident.incident_ref as varchar),5)
end




"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search