| )''''
PRINT @sql
print @sample
print @tbl
EXEC SP_EXECUTESQL @sql,N''''@sample nvarchar(30) OUTPUT'''',@sample OUTPUT
INSERT INTO #tc SELECT *,ltrim(ISNULL(@maxlen,0)) as MaxLenUsed,
convert(nchar(20),ltrim(ISNULL(@sample,'''' ''''))) as Sample,'''' '''' Comment FROM #t where TableName=@tbl and FieldName=@fld
END
FETCH NEXT FROM read_cursor INTO @tbl,@fld
END
CLOSE read_cursor
DEALLOCATE read_cursor
GO
SET ANSI_NULLS ON
GO
SET NOCOUNT OFF
GO
select count(*) from #t
DROP TABLE #t
GO
select count(*)-1 from #tc
select * into ##tx from #tc order by tablename
DROP TABLE #tc
--select * from ##tx
declare @db nvarchar(60),@sql nvarchar(3000)
set @db=db_name()
--请修改用户名和口令 导出到Excel 中
set @sql=''''exec master.dbo.xp_cmdshell ''''''''bcp ..dbo.##tx out c:\''''+@db+''''_exp.xls -w -C936 -Usa -Psa ''''''''''''
print @sql
exec(@sql)
GO
DROP TABLE ##tx
GO
-- ======================================================
--根据表中数据生成insert语句的存储过程
--建立存储过程,执行 spGenInsertSQL 表名
-- 上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页 |