n this call to SQL db how do I declare @k1, @k2, @k3?

297 views Asked by At

This is a query from Minitab to SQL db.

In this call to SQL db how do I declare @k1, @k2, @k3?

 ODBC;  
   Connect "DSN=STEConversion;APP=Minitab 17 Statistical Software;WSID=CMM-OFF" &
   "ICE;DATABASE=STEConversion;Trusted_Connection=Yes";
   SQLString "SELECT ""CharacteristicNumber"",""DateRecorded"",""DrawingNumber" &
   """,""DrawingRequirement"",""EnteredText"",""EnteredValue"",""EnteredValueH" &
   "igh"",""Entries"",""HighLimit"",""LowLimit"",""MONumber"",""NAME"",""Opera" &
   "tionSequenceNumber"",""PARENT"",""UserID"" FROM ""STEConversion"".""dbo""." &
   """vwMinitabMORoutingData"" where  ""PARENT""=@k1 And  ""OperationSeque" &
   "nceNumber""=@K2 And  ""CharacteristicNumber""=@k3".

Hi All,

Just in case someone has the answer someday!

below lets me prompt the user for Parent Number, then Operation Number, and Character Number, I can the do many things with this data, except pass it to the ODBC Call.

This are the commands I used, and below that are the errors.

I will post the answer, when I have it!


Commands

NOTE What is Parent Number?

SET C1; 

FILE "TERMINAL";

NOBS 1.

NOTE What is Operation Number?

SET C2; 

FILE "TERMINAL";

NOBS 1. 

NOTE What is Character Number?

SET C3; 

FILE "TERMINAL";

NOBS 1. 

let k1 = concatenate("""",c1[1],"""")

let k2 = concatenate("""",c2[1],"""")

let k3 = concatenate("""",c3[1],"""")

Print k1 k2 k3




ODBC;
Connect “DSN=STEConversion;APP=Minitab 17 Statistical Software;WSID=CMM-OFF” &
“ICE;DATABASE=STEConversion;Trusted_Connection=Yes”;
SQLString “SELECT “”CharacteristicNumber””,””DateRecorded””,””DrawingNumber” &
“””,””DrawingRequirement””,””EnteredText””,””EnteredValue””,””EnteredValueH” &
“igh””,””Entries””,””HighLimit””,””LowLimit””,””MONumber””,””NAME””,””Opera” &
“tionSequenceNumber””,””PARENT””,””UserID”” FROM “”STEConversion””.””dbo””.” &
“””vwMinitabMORoutingData”” where “”PARENT””=” &
k1 &
“And “”OperationSequenceNumber””=” &
k2 &
“ And “”CharacteristicNumber””=” &
k3.

This is the error I get!

MTB > Execute "\ste1\users$\jmccafferty\documents\MiniTab\Exec Files\Get_Data_ParentNo_OpNo_CharNo.mtb" Executing from file: \ste1\users$\jmccafferty\documents\MiniTab\Exec Files\Get_Data_ParentNo_OpNo_CharNo.mtb What is Parent Number? DATA> 1524 What is Operation Number? DATA> 110 What is Character Number? DATA> 118

Data Display

K1 "1524" K2 "110" K3 "118"

  • ERROR * Extra text is not allowed.

  • Remaining subcommands ignored.

  • ERROR * Extra text is not allowed.

  • ERROR * Extra text is not allowed.

  • ERROR * Extra text is not allowed.

  • ERROR * Extra text is not allowed.

  • Completion of computation impossible.

  • ERROR * Unrecognized variable name.

  • Possible cause: extra text.

  • Remaining subcommands ignored.

  • Completion of computation impossible.
1

There are 1 answers

0
jmccafferty On

Here is the code that works, with a little help from Minitab support.

NOTE What is Parent Number?
TSET C1; 
  FILE "TERMINAL";
  END

NOTE What is Operation Number?
TSET C2; 
  FILE "TERMINAL";
  END

NOTE What is Character Number?
TSET C3; 
  FILE "TERMINAL";
  END

let k1 = concatenate("''",c1[1],"''")
let k2 = concatenate("''",c2[1],"''")
let k3 = concatenate("''",c3[1],"''")

erase C1 C2 C3

Print k1 k2 k3


ODBC;
Connect "DSN=STEConversion;APP=Minitab 17 Statistical Software;WSID=CMM-OFF" &
"ICE;DATABASE=STEConversion;Trusted_Connection=Yes";
SQLString "SELECT ""CharacteristicNumber"",""DateRecorded"",""DrawingNumber" &
""",""DrawingRequirement"",""EnteredText"",""EnteredValue"",""EnteredValueH" &
"igh"",""Entries"",""HighLimit"",""LowLimit"",""MONumber"",""NAME"",""Opera" &
"tionSequenceNumber"",""PARENT"",""UserID"" FROM ""STEConversion"".""dbo""." &
"""vwMinitabMORoutingData"" where ""PARENT""=" &
k1 &
"And ""OperationSequenceNumber""=" &
k2 &
" And ""CharacteristicNumber""=" &
k3.

Hope it helps someone!!

Jim