cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User
Super User

Re: SQL Column name limitation

@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
Highlighted
Super User
Super User

Re: SQL Column name limitation

@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."

Highlighted
Super User
Super User

Re: SQL Column name limitation

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"
) 

 

Highlighted
Community Support
Community Support

Re: SQL Column name limitation

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.
Highlighted
Super User
Super User

Re: SQL Column name limitation

@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

Highlighted
Regular Visitor

Re: SQL Column name limitation

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

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,679)