|
We have one particular SQL Server 2008 query (not a stored proc, but the same SQL string -- executes every 5 minutes) that intermittently caches a very bad query plan.
This query normally runs in a few milliseconds, but with this bad query plan, it takes...
Started by Jeff Atwood on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at serverfault):
Can get the cache name of a bad query plan if you have the plan handle (from sys.dm_exec on cp.memory_object_address = ce.memory_object_address where cp.plan_handle = @bad_plan
However all SQL_query_stats qs CROSS APPLY....
|
|
The short story is I have a SQL Server DB with varchar fields instead of datetime (don't ask, it's a long story and can't be fixed). Somehow we've recently been getting weird / random characters inserted in these fields instead of what should be there...
Started by Randall on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
CASE WHEN ISDATE(closeddate) = 1 THEN CAST(c.closeddate AS DATETIME) ELSE NULL END
Looks to be all fixed, thankyouverymuch! here's my final result:
AND case WHEN ISDATE (closeddate) = 1 THEN CAST(c.closeddate AS DATETIME) ELSE NULL END BETWEEN @StartDate... .
|
|
I've inherited a clunky and horribly un-documented site from a bad developer and am trying to get a look at the database schema. Unfortunately the web host is the worst I've ever dealt with and has no control panel capability for viewing the db schema...
Started by Deca on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
They would also be useful.
I'm not sure if simple queries like
SHOW TABLES; DESCRIBE table_name; SHOW TABLE STATUS from table_name;
are valid in MS SQL.
An API to get at the metadata in SQL Server.
|
Ask your Facebook Friends
|
Java 1.4 Sql server 2000
i am taking input of sql query (for validation of field value against values retrieved by executing sql query) from admin user which will be stored in database and later i will executing sql query corresponding to field.Before...
Started by sahil garg on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Dont think there is any (easy) way to validate sql
Sql syntax be to just execute the sql statent and if you have a SQl exception see if its a bad syntax thats causing....
The appropriate query with the entered value.
|
|
How to convert result of an select sql query into a new table in msaccess ?
Started by silverkid on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Better to start....
When asked what tables to show, select the query tab and your saved query at all.
B) Create a make table query.
Save it.
To do it through the user interface, you can also:
A) Create and test the select query.
|
|
Are there any performance issues if an sql query contains lot of joins?
Started by jayaprakashbr on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Personally, unless a query sorts of details....
More in this article
Performance Tuning SQL Server Joins
There can be -- but query performance in analyzing your queries, figuring out where they're bad, and cleaning them up.
|
|
Can I write the T-SQL like below
select * FROM (select * from TableA where FieldA = 1 ) where FieldB > 10
which means I want to query from the result of another query.
Started by Yongwei Xing on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
However this actually makes your code faster so it's not always a bad thing..
|
|
Hello,
This question is linked to my previous one ( posted as an anonymous user - now I have an account ) and, before I begin, I would like to give the credit to Rob Farley for providing the right indexing schema.
But the problem is not the indexing schema...
Started by Adrian S. on
, 5 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The variable (in the third query)? It's odd that the query optimizer makes such a bad decision whenIs there a reason you can't use index hints (as in your second query) when you're using the indexes themselves are only built....
|
|
What is wrong with this sql query. i cant figure it out.
$query = "SELECT * FROM tagPairs WHERE (tag1Id IN ($tag1Id, $tag2Id)) AND (tag2Id IN ($tag1Id, $tag2Id))";
error code:
Couldn't execute query: You have an error in your SQL syntax; check the manual...
Started by noname on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Also, selecting * is a bad($tag1Id); $tag2Id = intval($tag2Id); $query = "SELECT * FROM tagPairs WHERE (tag1Id IN ($tag1Id, $tag2Id.
Assign a value to them and it should work fine .
And $tag2Id are empty strings.
|
|
Okay I have two variables in PHP
$username; $password;
which are initialized to the data retrieved from $_POST variable :)
I have this SQL query
$sql = "SELECT * FROM users WHERE username = '" . $username . "' AND password = '" . $password . "')";
But...
Started by mnhab on
, 11 posts
by 11 people.
Answer Snippets (Read the full thread at stackoverflow):
[Edit] - for those screaming SQL injection attacks: weeeek! sql injection....
You seem to have an excess closing parenthesis at the end of your query string.
BAD.
Oh, and thirded on SQL injection.
It shouldn't be there.
|