Help
From: :\) (anonymous_at_discussions.microsoft.com)
Date: 03/29/04
- Next message: Wayne Snyder: "Re: Books Online Updated"
- Previous message: Wayne Snyder: "Re: Help"
- In reply to: :\): "Help"
- Next in thread: Wayne Snyder: "Re: Help"
- Reply: Wayne Snyder: "Re: Help"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 29 Mar 2004 04:00:25 -0800
I changed it a bit.. can anyone tell me how i can get rid
of the "number 25" but keep what i am trying to do(cause
some tables have more columns and some have less than 25):
declare @i varchar(10)
set @i = '1'
while @i < 25
begin
select distinct o.name from syscomments c join
sysobjects o on o.id = c.id
where o.type IN ('TR','TF','P','X','V','FN')
and
c.text like '%order by ' + @i + '%'
set @i = @i+1
end
>-----Original Message-----
>Can anyone help me,
>I am writting a script where i get to find out all the
>store procedure, triggers,... that has the
command "..from
>table_name order by 2,1.." for example...
>
>Here is what i got as a base idea... hope you understand
>what i am trying to get at:
>declare @i int
>declare @tbnames varchar (150)
>set @i = 1
>
>declare test cursor for
> select [name] from sysobjects where xtype = 'U'
>
>open test
>fetch next from test into @tbnames
>
>if @@fetch_status = 1
>
>Begin
>
> if @i < 9
>
> begin
> select o.name from syscomments c join sysobjects o
>on o.id = c.id
> where o.type IN ('TR','TF','P','X','V','FN')
> and
> c.text like '%from ' + @tbnames + 'order by' + @i
>+ '%'
>
> set @i = @i + 1
> end
>
>
>fetch next from test into @tbnames
>
>End
>
>close test
>deallocate test
>
>Can anyone give me a hand with this please
>.
>
- Next message: Wayne Snyder: "Re: Books Online Updated"
- Previous message: Wayne Snyder: "Re: Help"
- In reply to: :\): "Help"
- Next in thread: Wayne Snyder: "Re: Help"
- Reply: Wayne Snyder: "Re: Help"
- Messages sorted by: [ date ] [ thread ]