Skip to content
Advertisement

Substring in select statement in JPQL

I’m trying to select a substring of column, i.e. select substring(description, 1, 200) from category where id=1 Is it possible to have a substring function within a select statement in JPQL/JPA 2? If yes, how? If no, are there any alternatives? Thanks. Answer There is a scalar expression for this: SUBSTRING(string, start, end) I believe this is allowed in the

How to drop multiple tables in PostgreSQL using a wildcard

When working with partitions, there is often a need to delete all partitions at once. However Does not work. (The wildcard is not respected). Is there an elegant (read: easy to remember) way to drop multiple tables in one command with a wildcard? Answer Use a comma separated list: If you realy need a footgun, this one will do it’s

How do I safely read from a stream in asp.net?

If: Reading from a stream in a single call to Read is very dangerous. You’re assuming all the data will be made available immediately, which isn’t always the case. You should always loop round, reading until there’s no more data. How should I change the above code to make it ‘less dangerous’? Answer Jon Skeet actually has a really good

Whats the size of an SQL Int(N)?

Simple question. I have tried searching on Google and after about 6 searches, I figured it would be faster here. How big is an int in SQL? — table creation statement. intcolumn INT(N) NOT NULL, — …

Advertisement