使用sql存储过程,可以创建一个表到一个过程中请不要回答这个问题 [英] Using sql store procedures,can create a table into a procedure are not please answere this question

查看:48
本文介绍了使用sql存储过程,可以创建一个表到一个过程中请不要回答这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在具有存储过程的sql服务器中,可以通过使用存储过程来创建表,而在该过程内部没有一个表,请清除描述此问题

in an sql server having stored procedures are there by using store procedure we can create a table are not inside the procedure any one please clear description this problem

推荐答案

如果直接在过程内编写create语句,它将彻底解决"Create或Alter语句应为查询批处理中的第一条语句"之类的错误.您可以通过使用存储过程中的动态sql执行create脚本来实现所需的功能.

但是,在花那么多的篇幅之前,为什么要在过程内创建表?如果要存储一些临时数据,请使用表变量进行操作.您可以发布您的需求吗?
If you write a create statement inside a procedure directly it will thorough an error like ''Create or Alter statement should be the first statement in a query batch''. You can acheive required functionality by executing the create script using dynamic sql inside the stored procedure.

But before going to those lengths, why you want to create a table inside a procedure? If you want to store some temp data do it with a table variable. Can you post your requirment?


我们肯定可以在存储过程中创建表和临时表.
we can definitely create a table and also a temp table into a stored procedure..


这篇关于使用sql存储过程,可以创建一个表到一个过程中请不要回答这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆