Desktop productivity for business analysts and programmers

& in sql code

Reply
Frequent Contributor
Posts: 124

& in sql code


I wrote a case statement

case when

else 'priya & insurance '

But where & sql is asking for substitute any idea ? how to solve . instead of using priya and insurance . I want priya& insurance in code

Valued Guide
Posts: 858

Re: & in sql code

else 'priya & insurance'n

'name'n will allow you to use any name in SAS.

Frequent Contributor
Posts: 124

Re: & in sql code

so what u want me to use

instead of using and  i want to use & and run sql developer

Super User
Posts: 19,194

Re: & in sql code

Your question is unclear.

If this is regarding SQL Server then asking it in a SAS forum may not be helpful.

Frequent Contributor
Posts: 124

Re: & in sql code

Do not use ampersand characters '&' in comments in a SQL statement or PL/SQL block. For example, if you enter a script such as:

This & that

error in that case what to do

Super User
Super User
Posts: 6,851

Re: & in sql code

Not sure what your question is.  It helps to copy in the actual error message.

Perhaps you used "'priya&insurance" then SAS will try to resolve the macro variable reference to the macro variable INSURANCE.

If you enclose your string in single quotes then SAS will not try to evaluate macro triggers like & and %.

'priya&insurance'

Ask a Question
Discussion stats
  • 5 replies
  • 355 views
  • 0 likes
  • 4 in conversation