日期型:(如2013-03-30)
@basic_date nvarchar(10)
date='''+convert(nvarchar(10),@date,121)+'''
字符型:
@name nvarchar(20)
name='''+@name+'''
数字型(int)的该怎么写呢?
------解决方案--------------------
给你个例子:
DECLARE @sql NVARCHAR(128)
DECLARE @int INT
SET @int=100
SET @sql='select top 1 * from sys.sysprocesses where spid<'+CONVERT (VARCHAR(10),@int)
EXEC (@sql)
/*
spid kpid blocked waittype waittime lastwaittype waitresource dbid uid cpu physical_io memusage login_time last_batch ecid open_tran status sid hostname program_name hostprocess cmd nt_domain nt_username net_address net_library loginame context_info sql_handle stmt_start stmt_end request_id