Skip to content
Advertisement

Tag: database

SQL Query Confused

Display: account no. customer id initial amount in terms of lakhs (rounded off to 2 decimals) [change the column heading to ‘INITIALAMTIN_LAKHS’] amount category(amt < 50000 show as 'Low', amt > …

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 EXISTS clause.

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 is stored in ‘2017-03-04 10:07:03.490’ format.

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 table that I have created. Here are some screenshots

Advertisement