I want to convert a string that can have two formats. Example 1090512300 to 9.5.123 1090501300 to 9.5.13 The first string (1090512300) will always have the same length but the second(9.5.123) string won’t. The conversion logic is as follows 1 xx yy zzz 00 So string 1 will be 1xxyyzzz00 and string 2 xx.y…
Tag: sql
insert if not exists in HQL
I am trying to write a query in HQL which can insert a record if it does not exists (with same name) so that there is no duplicate insertion when done from multiple threads. However, the record is not inserted. I suspect this is because the table is empty and the subquery returns 0 records despite the NOT EXI…
How to convert date time format in SQL Server like ‘2017-03-04 10:07:03.490’ to date format which is seperated by – like ‘2-11-2016’
I am tying to make date comparison with the query but it throws this error: Msg 242, Level 16, State 3, Line 1 The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. My application passes data in ’01/05/2017′ format and the date information in SQL Server i…
how to convert integer minutes to interval in postgres
I’m trying to convert minutes which are in integer to interval in postgres Is there any function that will help me to convert it to interval or should i have divide it by 60 and get the final result Answer Fastest way is with make_interval So it looks like this (as suggested by @Teddy) or, Not to say th…
Wildcard list of numbers after comma and join on single value [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 months ago. Improve this question I have TABLE A with one of the columns containing a single value and TABLE B with one of th…
Parameterized queries + DoCmd.TransferSpreadsheet acExport
I need to export a large amount of complex data to an excel spreadsheet. To facilitate this, I have created several large queries. Now I’m looking to filter these queries based on date range and some other tidbits of information, but I am unsure how to do so. DoCmd.TransferSpreadsheet acExport, , “…
How to get values of script sql to an object java
I have two object Person and Student Mapped with hibernate in my database and another object ObjectPR which brings together the two for showing values of two objects in same view and this is my code java for getting list of ObjectPR and this is my ObjectPR Class and I got this error Answer I think the NEW ope…
Time difference between two date fields
I have a date field names “dts” in string format. I want to find out all the records based on their time differences (in hours). The run event time should be greater than or equal to eat event. The output should be: Answer Convert timestamps to seconds, then subtract, divide result by 3600 to get …
Invalid object name in SQL Management Studio
I’ve been creating a database for class and I’m having trouble seeing my tables. I have a total of 12 tables I have created, 3 via CREATE TABLE statements and the rest using the SQL Server Management Studio, I’m trying to enter an INSERT INTO statement but it’s not recognizing the tabl…
SQL select min() using SQL join
I need result like this (in Oracle SQL): Name Producer Min Price HDD 250 gb Western Digital 6000 HDD 500 gb Corsair 4000 HDD 750 gb Corsair …