bibi92
asked on
Error on sql statement
Hello,
When I try :
declare @sql2 varchar(max)
set @sql2 = 'IF exists (select * from ['+@SrvAbonne + '].['+ @DbCible + '].dbo.sysobjects where name = ''MSreplication_subscripti ons'')
BEGIN
delete from ['+@SrvAbonne + '].['+ @Dbcible + '].dbo.MSreplication_subsc riptions
where [publication] like ''' + @publication + ''' end'
execute (@sql2)
print(@sql2)
I have this error:
The OLE DB provider "SQLNCLI" for linked server "SRVTEST" does not contain the table ""TEST"."dbo"."MSreplicati on_subscri ptions"". The table either does not exist or the current user does not have permissions on that table. #7314
I don't understand why because I check 'IF exists (select * from ['+@SrvAbonne + '].['+ @DbCible + '].dbo.sysobjects where name = ''MSreplication_subscripti ons'')
Thanks
Regards
bibi
When I try :
declare @sql2 varchar(max)
set @sql2 = 'IF exists (select * from ['+@SrvAbonne + '].['+ @DbCible + '].dbo.sysobjects where name = ''MSreplication_subscripti
BEGIN
delete from ['+@SrvAbonne + '].['+ @Dbcible + '].dbo.MSreplication_subsc
where [publication] like ''' + @publication + ''' end'
execute (@sql2)
print(@sql2)
I have this error:
The OLE DB provider "SQLNCLI" for linked server "SRVTEST" does not contain the table ""TEST"."dbo"."MSreplicati
I don't understand why because I check 'IF exists (select * from ['+@SrvAbonne + '].['+ @DbCible + '].dbo.sysobjects where name = ''MSreplication_subscripti
Thanks
Regards
bibi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks bibi
ASKER
'IF (select * from ['+@SrvAbonne + '].['+ @DbCible + '].dbo.sysobjects where name = ''MSsubscription_agents'')
then
delete from ['+@SrvAbonne + '].['+ @Dbcible + '].dbo.MSreplication_subsc
where [publication] like ''' + @publication + ''' end if' :
An expression of non-boolean type specified in a context where a condition is expected, near 'then'. #4145
Thanks
Regards
bibi