Lets say I have one table called “REVIEWS” This table has Reviews that customers have written for various products. I would like to be able to get a “count” for all the reviews that each customer …
How to precompile stored procedures in SQL server?
Is there any way to pre compile stored procedures in SQL Server? My requirement goes like this.. I have some stored procedures, which take more time in compiling than executing. So I want to precompile all the stored procedures. It would be nice to precompile them when the db server is started and running. Any ideas on this would be
Running a .sql script using MySQL with JDBC
I am starting to use MySQL with JDBC. I have 3-4 tables to create and this doesn’t look good. Is there a way to run a .sql script from MySQL JDBC? Answer Ok. You can use this class here (posted on pastebin because of file length) in your project. But remember to keep the apache license info. JDBC ScriptRunner It’s
Best way to determine Server Product version and execute SQL accordingly?
This is a two-pronged question: Scenario: I have a script to query MSDB and get me details of job schedules. Obviously, the tables differ from SQL 2000 to SQL 2005. Hence, I want to check the version running on the box and query accordingly. Now the questions: Question 1: This is what I am doing. Is there a better way
SQL Bulk Insert with FIRSTROW parameter skips the following line
I can’t seem to figure out how this is happening. Here’s an example of the file that I’m attempting to bulk insert into SQL server 2005: ***A NICE HEADER HERE*** 0000001234|SSNV|00013893-03JUN09 …
Condition within JOIN or WHERE
Is there any difference (performance, best-practice, etc…) between putting a condition in the JOIN clause vs. the WHERE clause? For example… Which do you prefer (and perhaps why)? Answer The relational algebra allows interchangeability of the predicates in the WHERE clause and the INNER JOIN, so even INNER JOIN queries with WHERE clauses can have the predicates rearrranged by the
DCount vs. SQL SELECT COUNT(*)?
I am trying to get a count of all items sent to a supplier based on the purchase order they are assigned to. But I can’t seem to get the control to show a number of items based on the purchase order instance – it keeps throwing either a #name? or #error! message in the text box when the form
SQL to check if database is empty (no tables)
I need to check if a database is totally empty (no tables) using an SQL query. How can this be done? Thanks for the help! Answer will return the actual number of tables (or views) in your DB. If that number is 0, then there are no tables.
Deferrable Constraints in SQL Server
Do any versions of SQL Server support deferrable constraints (DC)? Since about version 8.0, Oracle has supported deferrable constraints – constraints that are only evaluated when you commit a …
Delete duplicate records from a SQL table without a primary key
I have the below table with the below records in it I dont have any primary key in this table .But i have the above records in my table already. I want to remove the duplicate records which has the same value in EmpId and EmpSSN fields. Ex : Emp id 5 How can I frame a query to delete