Posted by Mike Epprecht \(SQL MVP\) on 10/23/55 11:34
Maybe more than one row is returned, and only one value can fit into a
variable.
This will work:
declare @oname sysname
select TOP 1 @oname=name from sysobjects where name like
"df__mytable__mycol%"
alter table mytable drop constraint @oname
Regards
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
<JLavalley@Enlighten.Net> wrote in message
news:1134587099.580770.161300@g44g2000cwa.googlegroups.com...
> Can someone explain to me why the following doesn't work?
>
> declare @oname sysname
> select @oname=name from sysobjects where name like
> "df__mytable__mycol%"
>
> alter table mytable drop constraint @oname
>
Navigation:
[Reply to this message]
|