SQL贴出来
要不看不明白
要不看不明白
解决方案 »
- 如何把float转换为varchar
- 举例说明SQL语言是完备的关系数据语言.
- 当内容是date时,日期范围可 between '1980/1/1' and '2050/1/1',就基本囊括所有日期;但是nvarchar时,如何能囊括所有内容?即between an
- select top 的问题
- sql语句
- 谁能帮帮忙,把这两段oracle 函数转变为 sql server,多谢 !!!!
- datatime的问题。
- 请问text字段怎么只能放1000个汉字???给100
- 请教ORACLE和SQL SERVER的差别是什么?那位都用过?谈谈经验!
- 请问WIN98+SQL7.0,数据库记录有100万条了,用VB查询如何提高查询速度?
- ====>>> 数据库设计规范V2.0 <<<=====
- SQL查询统计问题!
create proc proc_addtable
as
if exists(select * from sysobjects where id=object_id('newtable') and xtype='u')
drop table newtable
else
create table newtable (i int,ii datetime)
select * from newtable
--run
exec proc_addtable
如你所写我执行了exec proc_addtable
但是查询分析器提示:
服务器: 消息 208,级别 16,状态 1,过程 proc_addtable,行 7
对象名 'newtable' 无效。 我自己也看了在该存储过程所属的数据库中找不到该表。
DROP procedure proc_addtablego
create proc proc_addtable
as
if exists(select * from sysobjects where id=object_id('newtable') AND OBJECTPROPERTY(ID,N'IsUserTable') = 1)
drop table newtable
else
create table newtable (i int,ii datetime)
select * from newtable
drop table newtable--增加这句话就可以了
go
exec proc_addtable--如果不增加这句话的话,第一次执行是可以的,第二次就不成了,间隔性的成功
create proc proc_addtable
as
if exists(select * from sysobjects where id=object_id('newtable') and xtype='u')
begin
drop table newtable
end
create table newtable (i int,ii datetime)
select * from newtable
create proc p_test
as
if not exists(select 1 from syscolumns where object_id('tb')=id
create table tb(id int)
go--测试
exec p_test
select * from tb