sql - create/alter procedure with if object_id is not null then drop? -


i want procedure first checks, if temp table exists. if drop table , move on select table. got error:

'create/alter procedure' must first statement in query batch. 

my code looks this:

go set ansi_nulls on go set quoted_identifier on go  create procedure [dbo].[getdata]     @param_id int begin  if object_id('temp_table') not null drop table temp_table  select data_info temp_table data_info_table1  end 

but keep on getting same error. suggestions?

do want procedure ansi nulls? try setting set ansi null on inside of procedure.

also, if executing manually, can change options first selecting code , running it, selecting stored procedure , running separately.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -