Hi, I want to create cursors with parameter like in Oracle and I've read somewhere that you can't pass parameters(In SQL Server 7 Documentation...)in their declaration.
I want to retrieve all columns for all tables in an other database and i want to make a comparison between mine and the other.
So I create a cursor to get all the tablenames of my database and compare the columns.
I've thought about execute('Declare cListeDetailleTablesRef cursor local
For select a.name ,c.name ,a.prec
from @CH_NOM_SERVEUR+'.'+@CH_NOM_BASE+'.'syscolumns a,
@CH_NOM_SERVEUR+'.'+@CH_NOM_BASE+'.'sysobjects b,
@CH_NOM_SERVEUR+'.'+@CH_NOM_BASE+'.'systypes c
where a.id = b.id
and a.xtype=c.xtype
and b.xtype='U'
and b.name ='+ @CH_NOM_TABLE_REF),
but I'd like to know if there is a solution and if what I've thought was correct.
Thanks by advance,
Regards
I want to retrieve all columns for all tables in an other database and i want to make a comparison between mine and the other.
So I create a cursor to get all the tablenames of my database and compare the columns.
I've thought about execute('Declare cListeDetailleTablesRef cursor local
For select a.name ,c.name ,a.prec
from @CH_NOM_SERVEUR+'.'+@CH_NOM_BASE+'.'syscolumns a,
@CH_NOM_SERVEUR+'.'+@CH_NOM_BASE+'.'sysobjects b,
@CH_NOM_SERVEUR+'.'+@CH_NOM_BASE+'.'systypes c
where a.id = b.id
and a.xtype=c.xtype
and b.xtype='U'
and b.name ='+ @CH_NOM_TABLE_REF),
but I'd like to know if there is a solution and if what I've thought was correct.
Thanks by advance,
Regards