请问在DELPHI中如何动态创建一个表或存储过程呢??能给个例子吗?

解决方案 »

  1.   

    adoquery1.sql.text:='create table test(a int,b int) '
    adoquery1.execsql;adoquery1.sql.text:='create procedure p_test(@a int) '+
                        'as '+
                        'begin '+
                        'declare @i int '+
                        ' set @i = 9 '+
                        ' print @i '
                        'end ';
     adoquery1.execsql;
      

  2.   

    adoquery1.sql.text:='create table test(a int,b int) '
    adoquery1.execsql;adoquery1.sql.text:='create procedure p_test(@a int) '+
                        'as '+
                        'begin '+
                        'declare @i int '+
                        ' set @i = 9 '+
                        ' print @i '+
                        'end ';
     adoquery1.execsql;
      

  3.   

    任何创建表、存储过程、视图、数据库的语句,在Delphi中都相当于使用insert或是update的方法是一样的,但如果你要创建的是临时表的话就应该在表的前面加上'#'字符就可以了,这样在这个连接结束后,这个表就会自动释放了。