we are migrating over to oracle from sql server side. on sqlserver we used to have a view like the following create view blah AS Select column1, column2 FROM blah; but doing this on …
Delete duplicated rows and Update references
How do I Delete duplicated rows in one Table and update References in another table to the remaining row? The duplication only occurs in the name. The Id Columns are Identity columns. Example: Assume …
PHP MySQL INSERT return value with one query execution
Is there anything returned from MySQL/PHP on a INSERT query being executed? Here is my function which I have in a CLASS. This is how I call the function But executing a INSERT query the $rs returns nothing. Does my function need help or is this the default behavior? Any tips would be helpful as well. Answer INSERT just returns
Combining OUTER JOIN and WHERE
I’m trying to fetch some data from a database. I want to select an employee, and if available, all appointments and other data related to that employee. This is the query: SELECT TA.id, TEI….
How to add a Try/Catch to SQL Stored Procedure
In this proc how can I handle try catch for exception? Answer See TRY…CATCH (Transact-SQL)
Counting DISTINCT over multiple columns
Is there a better way of doing a query like this: SELECT COUNT(*) FROM (SELECT DISTINCT DocumentId, DocumentSessionId FROM DocumentOutputItems) AS internalQuery I need to count the number of …
Changing INT to BigInt
I have a warehouse table with 16 tons of data in it. I have a few Integer columns in it. We have to cast these into BIGINT for every query we write, because the SUM is too large to fit in an INT. We now have a new datamart under development. So we thought, why not change all these columns
Incorrect syntax near the keyword ‘with’…previous statement must be terminated with a semicolon
Im using SQL Server 2005 . I have 2 WITH Clauses in my stored procedure But the error occurs Incorrect syntax near the keyword ‘with’. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon. What are my options? Is there any splitter I don’t know about? Answer Use
Select latest revision of each row in a table
I have table structures that include a composite primary key of id & revision where both are integers. I need a query that will return the latest revision of each row. If I understood this answer …
Access sometimes jumps to existing record on save new record – Access2k FE/SQL2005 BE
I am really posting this out of desperation after searching around a lot for an answer and trying a few different things with no success. I have an Access database where I have recently migrated the tables to SQL 2005, Access continues to function to the users as a front-end providing forms, reports, and queries. However, since moving to the