How to create a table with dynamic table name
Posted in 2003
<html><div style='background-color:'><DIV> <DIV class=Section1> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">For a web application, I need to create a table with a dynamic name. I wonder if it is possible to have the following procedure created in INFORMIX. If not, what is the proper way to handle this ?<SPAN style="mso-spacerun: yes"> </SPAN>Thanks in advance !<SPAN style="mso-spacerun: yes"> </SPAN>-Cathy<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">----------------------------------------------<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Procedure to create table with dynamic<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">CREATE PROCEDURE <SPAN class=SpellE>sfa_newtable</SPAN>(<SPAN class=SpellE>tablename</SPAN> char)<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-tab-count: 1"> </SPAN>Create<SPAN style="mso-spacerun: yes"> </SPAN>TABLE<SPAN style="mso-spacerun: yes"> </SPAN><SPAN class=SpellE>tablename</SPAN>(<SPAN style="mso-spacerun: yes"> </SPAN><o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=SpellE><SPAN class=GramE>terr_nbr</SPAN></SPAN><SPAN style="mso-spacerun: yes"> </SPAN>char(7),<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=SpellE><SPAN class=GramE>act_date</SPAN></SPAN><SPAN style="mso-spacerun: yes"> </SPAN>date,<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=SpellE><SPAN class=GramE>form_nbr</SPAN></SPAN><SPAN style="mso-spacerun: yes"> </SPAN>char(15),<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=SpellE><SPAN class=GramE>fid</SPAN></SPAN><SPAN style="mso-tab-count: 2"> </SPAN>integer,<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=SpellE><SPAN class=GramE>fname</SPAN></SPAN><SPAN style="mso-tab-count: 1"> </SPAN>char(35),<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=SpellE><SPAN class=GramE>lname</SPAN></SPAN><SPAN style="mso-tab-count: 1"> </SPAN>char(35),<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>addr1</SPAN> <SPAN style="mso-tab-count: 1"> </SPAN>char(40),<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>addr2</SPAN><SPAN style="mso-tab-count: 1"> </SPAN>char(40),<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>addr3</SPAN><SPAN style="mso-tab-count: 1"> </SPAN>char(40),<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>city</SPAN><SPAN style="mso-tab-count: 1"> </SPAN>char(30),<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style="mso-tab-count: 1"> </SPAN><SPAN class=GramE>state</SPAN><SPAN style="mso-tab-count: 1"> </SPAN>char(2),<o:p></o:p></SPAN></FONT></P> <P class=MsoNormal style="mso-layout-grid-align: none"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><SPAN style=@