Facing error using single quotes in synapse pipeline source query that is parameterized

Samrudhi Madre 1 Reputation point
2022-01-21T09:16:55.587+00:00

Hi Team,

I am trying to use a source query like 'Select 'ABC' as name, 'Mumbai' as City , * from TableName' which passed through a parameter using Vlookup
Parameter Name : Query
Value of the parameter : 'Select 'ABC' as name, 'Mumbai' as City , * from TableName' --> pointing to an Azure SQL DB

Now in the dataflow source query of my source : I am using $Query to pull the source query dynamically and fetch the data .
However the source query consists of single quotes for all the default values of string columns like name, City that i have passed.
In this case the expression builder is unable to parse this and throws and error.

Could you please help me out on any leads to deal with single quotes ? -- eg 'Mumbai' as City

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,637 questions
{count} votes

2 answers

Sort by: Most helpful
  1. HimanshuSinha-msft 19,491 Reputation points Microsoft Employee Moderator
    2022-01-27T22:12:03.997+00:00

    Hello @Samrudhi Madre ,
    Thanks for the ask and using Microsoft Q&A platform .
    As I understand at this time , the intend to pass the query dynamically and also to name the column differently , if thats not the case .
    What i did is I passed query as a paramter ( without quotes as SQL will take care of the column name ) .
    In my case I did queried the employee table and also used the As clause . The query was passed dynamically .

    169170-image.png

    169178-image.png

    169231-image.png

    169119-image.png

    I think you do not need to use the ' ' , if the intention here is to get the rename the column .

    Please do let me know if you have further queries .

    Thanks
    Himanshu

    -------------------------------------------------------------------------------------------------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

  2. Vincent Brandon 0 Reputation points
    2023-04-14T14:50:29.48+00:00

    This doesn't work for me. I'm trying to build a Snowflake SQL statement and can't get this to work correctly. Can we just use a different text editor? Almost any programming language supports both quote usage and explicit returns...

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.