Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2007-09-18 : 05:32:53
|
| Hi All,We are converting VB code to C# code..we have some .sql files but when we move forward we are getting error in .sql fileswe opened .sql file and found some places having syntax like where EmpID = #EmpID#but when we declare here declare @EmpID numeric (3,0)and replace #EmpID# by @EmpIDthen code works fine but before changing into .sql I just confirm that it is wrong syntax or its kind of syntax word that VB code identify?????T.I.A |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 06:11:08
|
How do your VB code look like that runs this SP above? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 06:29:01
|
Also NUMERIC(3, 0) only gives your access to integer values between -999 and +999 (inclusive). E 12°55'05.25"N 56°04'39.16" |
 |
|
|
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2007-09-18 : 07:18:44
|
| Hi VB Code like...'****************************************************************** ' Create SQL Execution Task '****************************************************************** Set objTask = mobjPackage.Tasks.New("DTSExecuteSQLTask") With objTask .Name = "Task1" End With Set objExecuteSQLTask = objTask.CustomTask With objExecuteSQLTask .ConnectionID = 1 .SQLStatement = SearchNReplace(ReadFile(sFilename), "#EmpID#", sEmpID) End With mobjPackage.Tasks.Add objTask Set objTask = Nothing Set objStep = mobjPackage.Steps.New objStep.Name = "Step1" objStep.TaskName = "Task1" mobjPackage.Steps.Add objStep Set objStep = Nothing '****************************************************************** ' Execute the Package '****************************************************************** ChangeAllStepsToRunOnMainThread mobjPackage.ExecutePrivate Function SearchNReplace(sString As String, _ sSearch As String, _ sReplace) As String On Error Resume Next Dim p As Integer Dim sTmp As String sTmp = sString Do p = InStr(sTmp, sSearch) If p Then sTmp = VBA.Left(sTmp, p - 1) & sReplace & Mid(sTmp, p + Len(sSearch)) End If Loop While p SearchNReplace = sTmp End Function |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 07:24:23
|
quote: Originally posted by under2811[br'****************************************************************** ' Create SQL Execution Task '****************************************************************** Set objTask = mobjPackage.Tasks.New("DTSExecuteSQLTask") With objTask .Name = "Task1" End With Set objExecuteSQLTask = objTask.CustomTask With objExecuteSQLTask .ConnectionID = 1 .SQLStatement = SearchNReplace(ReadFile(sFilename), "#EmpID#", sEmpID) .SQLStatement = SearchNReplace(ReadFile(sFilename), "@EmpID", sEmpID) End With mobjPackage.Tasks.Add objTask Set objTask = Nothing Set objStep = mobjPackage.Steps.New objStep.Name = "Step1" objStep.TaskName = "Task1" mobjPackage.Steps.Add objStep Set objStep = Nothing '****************************************************************** ' Execute the Package '****************************************************************** ChangeAllStepsToRunOnMainThread mobjPackage.Execute
E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|
|
|