How to translate SSMS script to SWE script

Hi team,

There are some discussions about the creating script on SSMS and translate it to SWE style. any material available somewhere? especially how to deal with these SWE variables.

Thanks in advance.

Roland

SolidworksElectrical
Answers 4
JS
JS 2021-04-08 Best Answer

SQL Server Management Studio

RY
RY 2021-04-08

thanks for sharing Jeff.

JJ
JJ 2021-04-08

Haha yes, Microsoft SQL Server Management Studio is what people mean (in this context) when they say SSMS.  Typically that's where DBA's and the like will generate SQL queries, and that's where we (SWE Application Engineers with knowledge of the database schema) can use tools like a query builder to build custom queries.

As you point out Roland, there are some syntax differences that make copying and pasting wholesale a little tricky; additionally, SWE has the nice expanding tables on the right of the expert mode query editor that can give you a really good look at the schema, and there are things that you can do in SWE (like using the %xxx% global variables, such as %ELEMENT_COUNT% for BOMs and such) that you can't do in SSMS. 

There's unfortunately no silver bullet best practice here, and none of this is especially fun - I recommend involving your VAR (GoEngineer customers can typically utilize my AE team at no add'l cost to write their queries) to get you going, and if you are taking a shot at this yourself, using SSMS to build out the query from a logical standpoint (as efficiently as you can) and then dropping it into SWE to finish out to check syntax and utilize those global variables.

I also find this forum to be a good place for "is this how you'd tackle this" type of questions, as there are some SWE heavy hitters that respond regularly here and can probably point you in the right direction on building queries to report back certain data.  I've seen significant convergence on customer needs around BOMs, wire/connection lists, harness documentation, etc, and once we've collectively figured some of this out, a lot of problems tend to be solved with variations on these custom queries.

RY
RY 2021-04-08

when the script copy&pasted to SWE, use have to do some formatting and insert SWE variables to the script to make the original SQL query works. that portion is not clear to me. any comment?