I wish to all know how the tables in my database are related to each other (i.e PK/FK/UK) and hence i created a database diagram of all my tables in SQL Server. The diagram that was created was not easily readable and had to scroll (horizontally and sometimes vertically) to see the table on the other end. In short SQL’s
Tag: sql
How to return result of a SELECT inside a function in PostgreSQL?
I have this function in PostgreSQL, but I don’t know how to return the result of the query: But I don’t know how to return the result of the query inside the PostgreSQL function. I found that the return type should be SETOF RECORD, right? But the return command is not right. What is the right way to do this?
Table-less UNION query in MS Access (Jet/ACE)
This works as expected: This fails with the error “Query input must contain at least one table or query”: Is this just a quirk/limitation of the Jet/ACE database engine or am I missing something? Answer You didn’t overlook anything. Access’ database engine will allow a single row SELECT without a FROM data source. But if you want to UNION or
SQL Server – Return value after INSERT
I’m trying to get a the key-value back after an INSERT-statement. Example: I’ve got a table with the attributes name and id. id is a generated value. INSERT INTO table (name) VALUES(‘bob’); …
How to perform a LEFT JOIN in SQL Server between two SELECT statements?
I have two SELECT statements in SQL Server like these: I want to perform a LEFT JOIN between these two SELECT statements on [UserID] attribute and [TailUser] attribute. I want to join existent records in second query with the corresponding records in first query and NULL value for absent records. How can I do this? Answer
Oracle, Make date time’s first day of its month
I have a datevariable, I would like to have convert it to first day of its monh, Eg: 10/10/2010 -> 01/10/2010 Eg: 31/07/2010 -> 01/07/2010 Answer According to http://psoug.org/reference/date_func.html, this should work a dandy…
Casue of SQLite Error: ‘Error #3132: Data type mismatch.’ in Adobe AIR
“SELECT * FROM locations JOIN section_has_location ON locations.location_id = section_has_location.location_id WHERE section_has_location.chapter_id =2 AND section_has_location.section_id=2” …
How do I import a sql data file into SQL Server?
I have a .sql file and I am trying to import it into SQL Server 2008. What is the proper way to do this? Answer If you are talking about an actual database (an mdf file) you would Attach it .sql files are typically run using SQL Server Management Studio. They are basically saved SQL statements, so could be anything.
How can I resolve “The cursor was not declared” from SQL Server
I am connecting to SQL Server via Spring in WebSphere. I have a piece of pretty simple dynamic SQL (below) that is throwing “The cursor was not declared.” One of the settings for the data source that seems relevant is the “select mode” is “cursor”. I’m not really sure what I need to do to resolve the error. edit The
Trigger created with compilation errors
I wrote this trigger to discount the top client in the database by 10% when a new purchase is made: However when i execute this statement i receive this message: Can someone please tell me what I am doing wrong? Thanks, Alex. UPDATE – Errors: Solution: Answer I don’t have your tables to hand so I can’t guarantee that I’ve