22,210
社区成员
发帖
与我相关
我的任务
分享
create procedure [dbo].[reader_proc]
(
@param varchar(max)
)
as
declare @sql varchar(max)
set @sql=@param
exec @sql
sql = "select * from [L2SettleDB].[dbo].[l2_L20110102] where merch_id='002853110000008' and sett_postdate>='20110102' and sett_postdate<='20110228'"
Dim strsql = "data source=192.168.0.188;database=L2SettleDB;User ID=sa;pwd=12345678" 'OK 清算机
myconnection = New SqlConnection(strsql)
Dim ds As New DataSet()
Dim da1 As New SqlDataAdapter()
da1.SelectCommand = New SqlCommand()
da1.SelectCommand.Connection = myconnection
da1.SelectCommand.CommandText = "reader_proc"
da1.SelectCommand.CommandType = CommandType.StoredProcedure
da1.SelectCommand.Parameters.Add("@param", SqlDbType.VarChar)
da1.SelectCommand.Parameters("@param").Value = sql
'da1.Fill(ds)
If stSql = "" Then
stSql = "select * from [L2SettleDB].[dbo].[l2_L" & Format(DateAdd("d", i, da), "yyyyMMdd") & "] " & strSql
Else
stSql = stSql & " union all " & "select * from [L2SettleDB].[dbo].[l2_L" & Format(DateAdd("d", i, da), "yyyyMMdd") & "] " & strSql
End If
delcare @sql varchar(max)
select @sql=isnull(@sql+'union ','')+'select * from '+name from sys.object
where right(name,8) between @begintime and @endtime
exec(@sql)