Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3318548
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:43:08+00:00 2026-05-17T22:43:08+00:00

In sql server 2005/2008, can anyone please advise me on how can i generate

  • 0

In sql server 2005/2008, can anyone please advise me on how can i generate scripts automatically of all the objects that let say starts with “Client_”

I already have a query that identifies all the object that starts from “client_”, but i also want to generate there scripts automatically. Doing it manually is a huge task.

select name,type_desc
from sys.objects
where object_definition(object_id) like '%client_%'

Please advise

Massive thanks
Amit

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:43:08+00:00Added an answer on May 17, 2026 at 10:43 pm

    I think you should use sp_helptext system procedure within your select statement.
    Also you could use database cursor to perform execution of sp_helptext in a loop:

    DECLARE @name SYSNAME -- object name  
    DECLARE @type_desc VARCHAR(MAX) -- path for backup files  
    DECLARE @sql VARCHAR(MAX)
    
    DECLARE db_cursor CURSOR FOR
    select name,type_desc
    from sys.objects
    where object_definition(object_id) like '%client_%'
    
    OPEN db_cursor   
    FETCH NEXT FROM db_cursor INTO @name, @type_desc  
    
    WHILE @@FETCH_STATUS = 0   
    BEGIN   
        SET @sql = 
        'sp_helptext @objname = ''' + @name + ''''
    
        EXEC (@sql)
    
        FETCH NEXT FROM db_cursor INTO @name, @type_desc 
    END   
    
    CLOSE db_cursor   
    DEALLOCATE db_cursor
    

    Additional solution is to use sys.syscomments system view. Example:

    SELECT o.name, o.[type], s.[text]
    from sys.objects o
    INNER JOIN sys.syscomments s ON o.[object_id] = s.id
    where object_definition(object_id) like '%client_%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone please tell me how to find the installed SQL Server 2005/2008/2008R2 report
How can I connect to an Oracle database and SQL Server 2005-2008 database with
In SQL Server 2005(2008 not tested), you can't create a temp function like #function_name
How can I create a primary key in SQL Server 2005/2008 of the format
Some SQL Server 2005 and 2008 questions. 1) Can they coexist on the same
I'm using sql server 2005/2008 and I have a table that it's PK (rec_index)
I stumbled across this oddity when multiplying DECIMAL numbers on SQL Server 2005/2008. Can
I know you can execute a Job in SQL Server 2005/2008 by sending a
This is puzzling me - in SQL Server 2005/2008, I can specify the default
Has anyone tried installing SQL Server 2008 Developer on a machine that already has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.