is there any way, to use a period (.) in the field name of Access?
For example if I have foo.bar as string. Access will give me the following error message:
This is not a valid name. Make sure it is a valid parameter or alias name,
that it does not include invalid characters or punctuation, and that the name
is not too long. (Error 3125)
I tried escaping it in many ways, like:
[foo.bar]
*foo.bar*
'foo.bar'
foo[.]bar
foo*.*bar
foo'.'bar
foo\.bar
Nothing seems correct, nothing seems to work. I need to put a period in the field name, I can't replace it with some different character. Is there any way to fix my problem?
Short answer is No.
You will have to live with that limitation.
My field names were measurements in millimeters, so I needed field names like 1.1, 1.2, etc. I used 1,1 as the field name and 1.1 as the caption and it worked fine.
Related
I am trying to search a store by its name, and when using mysql data binding, it adds a slash in between and prevents me from searching for the store name
The store name is Jimmy's Pita
When I run the query it looks like this
SELECT * FROM stores WHERE store_name = 'Jimmy\'s Pita'
But the store name in the database looks like this ... 'Jimmy's Pita & Poke'
What can I do to fix this issue?
Any help would be really appreciated!
This is to do with escaping. When you specify using single quotes you must escape other single quotes, as in:
'Jimmy\'s Pita'
If you use different quotes, which MySQL allows by default, then you can do this instead:
"Jimmy's Pita"
Both of these are equivalent and in both cases the data saved is:
Jimmy's Pita
The backslash is only there to deal with escaping issues. It is not literally part of the data.
When it comes to searching you may want to use the MySQL full-text index so you can get "close enough" matches, like searching for "jimmys pita" and so on.
I am trying to save some value prefixed with the currency symbol like in €10. Yet when I manually enter them in the DB the euro sign gets turned now and then in ?. When then I query the line I get sometimes again the question mark with the value and some other times NaN for the full value.
The issue changes if I query the line by using the email field or the unique identifier. Using $ or ® instead of € presents no problems; even ™ is turned to ?, though.
What is strange is that if I try to replace the question mark with the original character, MariaDB complains that there is no change in the line, like if that character were in fact present even if not shown!
I tried restarting MariaDB, just in case, but the problem remained.
I am using UTF32 for encodage and utf32_unicode_ci for collation.
I am testing the thing with Sequel_pro without even touching php not to stack things.
At any rate if I execute the query from a php script and parse the result with JSON I get null for the value.
What could be the issue with those special characters?
Plan A: Store the amount as a string and do not try to get the value out of it. This requires, as already mentioned, "utf8 all the way through".
Plan B: Store only the amount in a numeric field. Either store the 'currency' in another field as 'EUR' or 'USD' or ... Or simply assume that all amounts are Euros. Then put the Euro sign in front of the amount when you print it.
Do not use DOUBLE or FLOAT, you get an undesirable extra rounding. Instead, consider DECIMAL(11,2). That will exactly handle amounts in most countries. (A few countries need 4 decimal places; some can live with 0.)
Do not use utf32; use utf8 (or utf8mb4).
A database is a repository of data, not a formatting tool. Keeping this distinction will help avoid problem like this.
I can't find a proper way to escape apostrophe sign(’) in my mysql query. Regexp I have, works fine with online tools for regexp testing.
Problematic example is the string G’Schlössl.
I want to have optional apostrophe sign in the query in front of the s character G(’?)Schlö(’?)ssl for all the different cases which could occur in other strings. I am not sure if the problem is caused by incorrect sign escaping but I have tried many options like ’?, \’?, \’{0,1} which works for the first occurrence but doesn't for the second optional one and cause query to return nothing. Other possibilities like ’’?, [’]?, [\’]?, [\’]{0,1} does not work even for the first one.
select id, name from restaurant where name regexp '.*g\’?(s|ß|ss|sz)chl(o|ö|oe)\’?s.*';
When I remove the last \’? it works:
select id, name from restaurant where name regexp '.*g\’?(s|ß|ss|sz)chl(o|ö|oe)s.*';
When I replace the last \’? with x? it works as well:
select id, name from restaurant where name regexp '.*g\’?(s|ß|ss|sz)chl(o|ö|oe)x?s.*';
Any ideas where the problem is or what else to try?
This thread explains escaping normal single quote only, which seems not to work in my case.
Instead of \’?, try (’)?. I'm thinking that the ? may apply to only the last byte of ’. By using parentheses instead, the ? applies to the entire 3 bytes (hex E28099) of the "RIGHT SINGLE QUOTATION MARK".
How do I capitalize all text in a column of data in an Access Query while keeping the name of the field the same?
I tried entering "SPEC: StrConv([SPEC],3), but I get an error that I have a circular argument (which, isn't too surprising). So how do I get around this?
Is there a totally different approach to capitalizing in queries?
Given: we have a field named [SPEC].
Problem: need query to grab [SPEC] and convert it to all caps, but
with the same field name
Added: We will call the table that holds the field [SPEC],
[tblTable]
Solution:
What we need to put in the query builder is the following:
SPEC: UCase([tblTable].[SPEC])
That way the machine can figure out that Query.SPEC isn't the same identifier as tblTable.SPEC
Equivalently:
SELECT UCase([tblNames].[FirstName]) AS FirstName
FROM tblNames;
How about using the Ucase function
Ucase(String)
I would like to perform a MySQL regular expression which will check a string for both singular and plural version of the string.
I am ignoring special characters and complex grammar rules and simply want to add or remove an 's'.
For example if the user enters 'shoes' it should return matches for both 'shoes' and 'shoe'. Conversely, if the user enters 'shoe' it should return matches for both 'shoe' and 'shoes.
I am able to optionally check against the plural version of the match as follows:
WHERE Store.tags RLIKE ('(^|,)+[[:space:]]*shoe(s)*[[:space:]]*(,|$)+')
I have been reading up about positive/negative look-ahead or look-behind and I seem to be constantly chasing my tail.
Well if you're only asking about removing or adding an s ... make it simple as your requirements ...
Just check if last letter is an s.. if yes -> remove it for singular, if no, add one for plural
WHERE (a LIKE '%shoes%' OR a LIKE '%shoe%')
It's as dumb as it gets but seeing you only need to check for s .. it's good enough.