Sunday 15 February 2015

What is the equivalent of a TeraData PREPARE statement in SQL Server -



What is the equivalent of a TeraData PREPARE statement in SQL Server -

i in situation converting big tera info stored procedure sql server. have got through of it, below code has stumped me. trying find online help on this, apart description, haven't been able see working illustration of how prepare statement behaves in conjunction cursor. (i dont know much teradata , has been 2 weeks since started scratching surface)

set cur_stmt1=v_select_stmt||v_where_stmt; prepare s1 cur_stmt1; open cur1; set v_record_cnt = activity_count; if(v_record_cnt=0) close cur1; set cur_stmt1='select 0 cnt1,' || v_col_null_stmt; prepare s1 cur_stmt1; open cur1; end if;

can please help me translate code more t-sql'ised form?

to homecoming results of select need utilize cursor in teradata (and standard sql), of course of study not real cursor fetch 1 row after other, it's spool other result set.

in case there's select using dynamic sql, should translate t-sql as

exec sp_executesql @cur_stmt1;

and it's checking if reply set empty , returns single row reply set select 0 ... instead.

sql-server sql-server-2008 teradata data-migration prepare

No comments:

Post a Comment