存储过程的小问题 临时表不用createselect * into #table_name from table where ..... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 create procedure temp2asBegincreate table ##zfgzd( Zfdate datetime, Zfdh char (18), YearDate char (6), Sfbh int, Yhbh int, Personid int, Invoice_number char (20), Zfmoney float, Re char (30))endexec temp2select * from ##zfgzd 你是创建一个实际的表了你是想要用表变量吧?declare @zfgzd table ( Zfdate datetime, Zfdh char (18), YearDate char (6), Sfbh int, Yhbh int, Personid int, Invoice_number char (20), Zfmoney float, Re char (30)) #temp 局部TEMP TABLE##temp 全局TEMP TABLE-- must drop table ##temp 但我现在不想用全局表,这样多用户操作数据带来不便,如果不用存储过程在程序里执行。create table ##zfgzd( Zfdate datetime, Zfdh char (18), YearDate char (6), Sfbh int, Yhbh int, Personid int, Invoice_number char (20), Zfmoney float, Re char (30))select * from #zfgzd就可以, 没有其它的办法吗? 如果写在前台程序里,就得连接字符串.不方便.就可以 临时表不能在存储过程外调用,只能用##temp 全局临时表,那就和建一张普通表一样了 问一个重复数据查询的问题 SQL查询语句的问题,请大家帮一下 sql server的insert语句里不支持嵌套select语句,而oracle里支持,怎么办? 数据库整合问题 程序经常会出现 " 不属于表table" 的错误,用了这么久的SQL,第一次见到这种怪问题? 求一个SQL语句, 关于成组出现最多的~~ 建表问题:树型结构的保存,如何在数据库实现“环”约束 关于索引的问题!!!!!!!!!!!! 考勤系统中的排班算法问题,急,100分不够再加 用ado连接sqlserver在选择使用tcp/ip协议时如何指定连接使用的端口号??? 有这样的触发器吗? 如何选择一个表的中间一段数据?
as
Begin
create table ##zfgzd
(
Zfdate datetime,
Zfdh char (18),
YearDate char (6),
Sfbh int,
Yhbh int,
Personid int,
Invoice_number char (20),
Zfmoney float,
Re char (30)
)
end
exec temp2
select * from ##zfgzd
declare @zfgzd table
(
Zfdate datetime,
Zfdh char (18),
YearDate char (6),
Sfbh int,
Yhbh int,
Personid int,
Invoice_number char (20),
Zfmoney float,
Re char (30)
)
##temp 全局TEMP TABLE-- must drop table ##temp
create table ##zfgzd
(
Zfdate datetime,
Zfdh char (18),
YearDate char (6),
Sfbh int,
Yhbh int,
Personid int,
Invoice_number char (20),
Zfmoney float,
Re char (30)
)
select * from #zfgzd
就可以, 没有其它的办法吗? 如果写在前台程序里,就得连接字符串.不方便.
就可以