这个对SQL db的调用如何声明@ k1,@ k2,@ k3?

时间:2014-05-22 18:01:42

标签: sql-server variables odbc declare minitab

这是从Minitab到SQL db的查询。

在对SQL db的调用中,如何声明@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".

大家好,

万一有人有一天会得到答案!

下面的

让我提示用户输入父号,然后是操作号和字符号,我可以用这些数据做很多事情,除了把它传递给ODBC调用。

这是我使用的命令,下面是错误。

当我拥有它时,我会发布答案!


命令

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.

这是我得到的错误!

MTB>执行“\ ste1 \ users $ \ jmccafferty \ documents \ MiniTab \ Exec Files \ Get_Data_ParentNo_OpNo_CharNo.mtb” 从文件执行:\ ste1 \ users $ \ jmccafferty \ documents \ MiniTab \ Exec Files \ Get_Data_ParentNo_OpNo_CharNo.mtb 什么是家长号码? DATA> 1524 什么是操作号码? DATA> 110 什么是字符数? DATA> 118

数据显示

K1“1524” K2“110” K3“118”

  • 错误*不允许使用额外的文字。

  • 忽略了剩余的子命令。

  • 错误*不允许使用额外的文字。

  • 错误*不允许使用额外的文字。

  • 错误*不允许使用额外的文字。

  • 错误*不允许使用额外的文字。

  • 无法完成计算。

  • 错误*无法识别的变量名称。

  • 可能的原因:额外的文字。

  • 忽略了剩余的子命令。

  • 无法完成计算。

1 个答案:

答案 0 :(得分:0)

这是有效的代码,只需要Minitab支持的帮助。

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.

希望它有所帮助!!

吉姆