Skip to content
Advertisement

Tag: string

MONTHNAME in Portuguese MYSQL

I´ve got a huge query (In a PHP file) that gives me a monthname from some dates: Is there a way to insert my language inline with MONTHANAME? Something like: I don´t want to write case for eveymonth to transform ‘Dec’ to ‘Dez’ and so on, this will take too long. Answer Unfortunately in MySQL this cannot be done dynamically

Initcap of word

I’m having a table x it contain the column resource_name in this column I’m having data like NASRI(SRI). I’m applying initcap on this column it’s giving output Nasri(sri). But my expected output is Nasri(Sri). How I can achieve the desired result? Thank you Answer One possible solution is to use split() with concat_ws(). If value does not contain ‘()’, then

Deleting Part of a string in HIVE

I am trying to delete a part of a string in HIVE. I want to delete the last eleven characters for all records in a column. The data looks like: 1018492743|0001-01-01 I want it to look like: 1018492743 The code I have tried looks like: Select right(a.ord_id, len(a.ord_id)-ll) It isn’t working because len isnt a function in HIVE Another issue

How to run SQL queries in a loop

How can I run this SQL query multiple times in a loop, where I replace the word ‘pubs’ with another word during each iteration. Is there a way to store an array of strings and loop through them? Answer In general, it’s usually better performance-wise to do bulk or batch queries than queries in a loop, since you can save

SQL Server : ISNULL(compound NULL condition, ‘a string’) returns only the 1st character, under certain circumstance(s)

I’m a self-taught, vaguely competent SQL user. For a view that I’m writing, I’m trying to develop a ‘conditional LEFT’ string-splitting command (presumably later to be joined by a ‘conditional RIGHT’ – whereby: If a string (let’s call it ‘haystack’) contains a particular pattern (let’s call it ‘needle’), it will be pruned to the left of that pattern Otherwise, the

Advertisement