SQL 注意事项
——————-选择表名 配置Ctrl+3 能够select * 桌
USE [NB]
GO
/* 物: StoredProcedure [dbo].[SP_Select] 脚本日期: 05/28/2015 21:46:25 */
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Proc [dbo].[SP_Select]
@OName varchar( 100)
As
Declare @Str Varchar (1000),
@dbname varchar( 40)
set @dbname= db_name()
Set @Str= ‘Select * from ‘+@dbname +’.dbo.’+ @OName
Exec ( @Str)
——————-选中表名 配置为Ctrl+8 就可以查此表的全部列名
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROC [dbo].[sp_syscolumns] –Exec sp_syscolumns ‘eemployee’
@Object NVARCHAR( 1000)
As
/*
Function:取得一个对象中的全部列的项目 (主要针对表)
Remark: Create By Deam L 2013/4/7
*/
Begin
Set nocount on
Declare @Name NVARCHAR (1000)
Select @Name= Isnull(@Name +',', '')+name From syscolumns Where id=object_id( @Object)
Print @Name
Set nocount off
END
版权声明:本文博主原创文章,博客,未经同意不得转载。