Re: Help

From: Wayne Snyder (wsnyder_at_computeredservices.com)
Date: 03/30/04


Date: Tue, 30 Mar 2004 14:10:15 -0500

if you are looking for anything that has "order by " and a digit why not
take it out of the loop and try

c.text like '%order by [0-9]%'

-- 
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
":)" <anonymous@discussions.microsoft.com> wrote in message
news:14fc301c41585$6bb3b6b0$a401280a@phx.gbl...
> 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
> >.
> >


Relevant Pages

  • Re: Newbie Question on Jobs & Stored Procedures.
    ... > Sql Server. ... > FETCH NEXT FROM TASK_LIST ... > DECLARE @MSG INT ...
    (microsoft.public.sqlserver.programming)
  • Help
    ... that has the command "..from ... declare @tbnames varchar ... fetch next from test into @tbnames ...
    (microsoft.public.sqlserver.server)
  • Re: Removing Permissions from the public role
    ... I'm new to sql server but technically the t-sql below should work ... declare temp_curs cursor for select table_name from ... fetch temp_curs into @temp_table ...
    (microsoft.public.sqlserver.setup)
  • RE: SQL 2000 instance showing up as version6.5 after running fixre
    ... exec sp_configure N'allow updates', 1 ... DECLARE @username varchar ... FETCH NEXT FROM list_triggers INTO @name, ... create table syssubscriptions (artid int, srvid smallint, dest_db sysname, ...
    (microsoft.public.sqlserver.clustering)
  • RE: Error after Disabling Merge Replication
    ... FETCH NEXT FROM list_pubs INTO @name ... EXEC sp_droppublication @name ... DECLARE list_replicated_tables CURSOR FOR ... SELECT name FROM sysmergearticles ...
    (microsoft.public.sqlserver.replication)