select name as "+ month +"月用户 from userinfo where timeofmonth='"+ month +"'
month当作参数传过来,为什么查询的时候报错 说as 附近有错误
10 个解决方案
#1
select [name]=timeofmonth+'月用户'
from userinfo where timeofmonth='''+ month +'''
#2
declare @month varchar(50)
exec ('select [name] as '''+ @month + '''' + '月用户 from userinfo where timeofmonth = '''+ @month +'''')
#3
declare @month as varchar(2)
set @month = '..'
exec('select name as [' + @month + '月用户] from userinfo where timeofmonth = ''' + @month + '''' )
#4
不好意思 哦
我没用存储过程,如果不用存储过程能实现吗?
我没用存储过程,如果不用存储过程能实现吗?
#5
select name as ["+ month +"月用户] from userinfo where timeofmonth='"+ month +"'
#6
楼主你的month是从asp程序中传过来的?
sql="select name as "+ month +"月用户 from userinfo where timeofmonth="+month
#7
sql="select name as ''"+ month +"月用户'' from userinfo where timeofmonth="+month
#8
楼主试试看行不:
month=request("参数")
select name as "&month&"月用户 from userinfo where timeofmonth='"&month&"'
#9
select name as ["+ month +"月用户] from userinfo where timeofmonth='"+ month +"'
可以实现 谢谢各位的帮助!!
可以实现 谢谢各位的帮助!!
#10
'select [name] as '''+ @month + '''' + '月用户 from userinfo where timeofmonth = '''+ @month +''''
#1
select [name]=timeofmonth+'月用户'
from userinfo where timeofmonth='''+ month +'''
#2
declare @month varchar(50)
exec ('select [name] as '''+ @month + '''' + '月用户 from userinfo where timeofmonth = '''+ @month +'''')
#3
declare @month as varchar(2)
set @month = '..'
exec('select name as [' + @month + '月用户] from userinfo where timeofmonth = ''' + @month + '''' )
#4
不好意思 哦
我没用存储过程,如果不用存储过程能实现吗?
我没用存储过程,如果不用存储过程能实现吗?
#5
select name as ["+ month +"月用户] from userinfo where timeofmonth='"+ month +"'
#6
楼主你的month是从asp程序中传过来的?
sql="select name as "+ month +"月用户 from userinfo where timeofmonth="+month
#7
sql="select name as ''"+ month +"月用户'' from userinfo where timeofmonth="+month
#8
楼主试试看行不:
month=request("参数")
select name as "&month&"月用户 from userinfo where timeofmonth='"&month&"'
#9
select name as ["+ month +"月用户] from userinfo where timeofmonth='"+ month +"'
可以实现 谢谢各位的帮助!!
可以实现 谢谢各位的帮助!!
#10
'select [name] as '''+ @month + '''' + '月用户 from userinfo where timeofmonth = '''+ @month +''''