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 8699179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:53:07+00:00 2026-06-13T01:53:07+00:00

I am trying to output a string plus certain values I have obtained from

  • 0

I am trying to output a string plus certain values I have obtained from the database. For example, in Microsoft Server 2008, the following ran the way I wanted it to:

SELECT 
'SELECT c.name COLLATE SQL_Latin1_General_CP1_CI_AS colName, o.name COLLATE SQL_Latin1_General_CP1_CI_AS tableName, '''
+ NAME + ''' db FROM ' + NAME 
+ '.sys.all_columns as c INNER JOIN ' + NAME 
+ 
'.sys.all_objects o ON c.object_id = o.object_id WHERE c.name like ''%password%'' AND type = ''U'' UNION'
  FROM SYS.DATABASES 

Returning the following:

SELECT c.NAME COLLATE SQL_LATIN1_GENERAL_CP1_CI_AS colName, 
       o.NAME COLLATE SQL_LATIN1_GENERAL_CP1_CI_AS tableName, 
       'master'                                    db 
  FROM MASTER.SYS.ALL_COLUMNS AS c 
       INNER JOIN MASTER.SYS.ALL_OBJECTS o 
               ON c.OBJECT_ID = o.OBJECT_ID 
 WHERE c.NAME LIKE '%password%' 
       AND TYPE = 'U' 
UNION 
SELECT c.NAME COLLATE SQL_LATIN1_GENERAL_CP1_CI_AS colName, 
       o.NAME COLLATE SQL_LATIN1_GENERAL_CP1_CI_AS tableName, 
       'tempdb'                                    db 
  FROM TEMPDB.SYS.ALL_COLUMNS AS c 
       INNER JOIN TEMPDB.SYS.ALL_OBJECTS o 
               ON c.OBJECT_ID = o.OBJECT_ID 
 WHERE c.NAME LIKE '%password%' 
       AND TYPE = 'U' 
UNION 

But when I try a similar thing in MySQL:

 SELECT 
'SELECT c.name COLLATE SQL_Latin1_General_CP1_CI_AS colName, o.name COLLATE SQL_Latin1_General_CP1_CI_AS tableName, '''
+ DB + ''' db FROM ' + DB 
+ '.sys.all_columns as c INNER JOIN ' + DB 
+ 
'.sys.all_objects o ON c.object_id = o.object_id WHERE c.name like ''%password%'' AND type = ''U'' UNION'
  FROM DB 

It returns only blank lines of the records that I want. Can anyone help?

  • 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-06-13T01:53:09+00:00Added an answer on June 13, 2026 at 1:53 am

    In MySQL you need the concat function in instead of the + operator:

    SELECT concat(
    'SELECT c.name COLLATE SQL_Latin1_General_CP1_CI_AS colName, o.name COLLATE SQL_Latin1_General_CP1_CI_AS tableName, '''
    , DB , ''' db FROM ' , DB 
    , '.sys.all_columns as c INNER JOIN ' , DB 
    , 
    '.sys.all_objects o ON c.object_id = o.object_id WHERE c.name like ''%password%'' AND type = ''U'' UNION'
    )  FROM DB 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to output unicode string into RTF format. (using c# and winforms) From
I have a hashmap that contains multiple string arrays. I am trying to output
OK so I'm trying to output the current string from an array that was
I'm trying to output a string from an Object that has been passed into
I am trying to compare two text files and output the first string in
I am trying to output the value of x in the following request: http://localhost:4827/Default.aspx?x=123123
I am having trouble with pexpect . I'm trying to grab output from tralics
I have strings that look like these: {server}_{date:YYYYMMDD}{int:######} {server}_{date:MON DAY YYYY}{int:######} ...plus more, in
I'm trying to strip the numeric and punctuations from a string leaving only alpha
I'm trying to output a variable's literal string value, after it is being set

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.