cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

SQL Column name limitation

Hi,

 

I have a SQL Column called "MIM-Account" that give error on Search(), "MIMAccount" and "MIM_Account" works.

What is here the limitation?

image.png

many Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions

@MaVa 

Just to clarify this thing about delimiting names with back quotes (`), this relates to ODBC connections to SQL Server (as specified in the link). It doesn't apply to PowerApps. Delimiting your column name in PowerApps with a back quote won't solve the problem.

So I think really, RenameColumns is the only workaround here.  In terms of renaming your column names in SQL, this sometimes isn't possible, particularly if you don't own the database, or if it's already in use by other applications. In this case, a better option is to create a SQL View and to rename the output columns in the view.

 

View solution in original post

5 REPLIES 5
Super User III
Super User III

@MaVa 

Per the Microsoft documentation on this subject hypens are not-considered normal characters like letters, numbers and " _ ".  Best to stick with those characters for ease of use.

 

"Column names can contain any valid characters (for example, spaces). If column names contain any characters except letters, numbers, and underscores, the name must be delimited by enclosing it in back quotes (`)."

 

Link to Official MS Documentation

https://docs.microsoft.com/en-us/sql/odbc/microsoft/column-name-limitations?view=sql-server-ver15

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Super User III
Super User III

Hi @MaVa 

I've just tested this and I'm able to overcome this problem by calling RenameColumns. There doesn't seem to be any delegation problems with this approach either.

 

image.png

Perhaps that's something you could try as a workaround?

Search(RenameColumns('[dbo].[MIM_Accounts]', "MIM-Account", "MIMAccount"),
       '4LC_Search',
       "MIMAccount"
) 

 

Community Support
Community Support

Hi @MaVa ,

Could you please share a bit more about the error with your Search function?

 

Based on the issue that you mentioned, I think this issue is not related to PowerApps Itself. I agree with @mdevaney 's thought almost. The hypens (-) are not-considered normal characters, if you want to include a hypens (-) within a column name, the name must be delimited by enclosing it in back quotes (`).

 

You could consider change the column name in your SQL Table or take a try with @timl 's solution to rename the "MIM-Account" column to another name, then specify the another column as Search column within the Search function.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@MaVa 

Just to clarify this thing about delimiting names with back quotes (`), this relates to ODBC connections to SQL Server (as specified in the link). It doesn't apply to PowerApps. Delimiting your column name in PowerApps with a back quote won't solve the problem.

So I think really, RenameColumns is the only workaround here.  In terms of renaming your column names in SQL, this sometimes isn't possible, particularly if you don't own the database, or if it's already in use by other applications. In this case, a better option is to create a SQL View and to rename the output columns in the view.

 

View solution in original post

Regular Visitor

Thanks all for your reply, RenameColumns() works perfect.

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,616)