declare @cust_id int,
@sqlstr varchar (4000),
@sqlwhere varchar (4000)set @sqlstr='select * from table '
set @sqlwhere=' where cust_id = ' +cast(@cust_id as varchar)exec (@sqlstr+@sqlwhere)
@sqlstr varchar (4000),
@sqlwhere varchar (4000)set @sqlstr='select * from table '
set @sqlwhere=' where cust_id = ' +cast(@cust_id as varchar)exec (@sqlstr+@sqlwhere)
@sqlstr varchar (4000),
@sqlwhere varchar (4000)set @sqlstr='select * from table '
set @sqlwhere=' where cust_id =' +cast(@cust_id as varchar(20))
exec (@sqlstr+@sqlwhere)
declare @cust_id int,
@sqlstr varchar (4000),
@sqlwhere varchar (4000)set @sqlstr='select * from table1 '
set @sqlwhere=' where cust_id=' +cast(@cust_id as varchar) --( 这句该怎么写呢?字段cust_id 是数值型)exec (@sqlstr+@sqlwhere)