|
I would migrate to .net and make it DB agnostic using DBProviderFactories[^].
Then you can choose your poison in the app.config <connectionstrings> section.
|
|
|
|
|
I have purchased Visual Studio 2010 Professional.
Along with it SQL server express 2008 R2 has been installed, but I cannot find "SQL Server Management Studio". May be it may not be needed also.But for learning purpose I need it. If I download
from MSDN ,I will get SQL express 2005 and may be I will land in conflict. Please help me on this issue. Also I want to know is there
ADO.NET connectivity for VC++ also ?
Be Happy
|
|
|
|
|
adityarao31 wrote: I cannot find "SQL Server Management Studio".
Try here[^].
adityarao31 wrote: is there ADO.NET connectivity for VC++ also
It depends. If you are coding in CLI/CLR, then yes. If it's MFC, etc, no.
|
|
|
|
|
Thank you very much
Be Happy
|
|
|
|
|
I have two tables. I want to get all the rows from first table but want the where clause from another table. Here is my query. In following query I don't want any row from table tbTasks1 but the following query showing me rows from tbTasks1 also. Could u please modify this query.
select * from tbDocument,tbTasks1
where
tbTasks1.IsDelete = 0
|
|
|
|
|
There must be something that joins the two tables together... what is it? Use a join to attach the tables together like this:
select tbDocument.*
from tbDocument inner join tbTasks1 on tbDocument.FOREIGNKEY = tbTasks1.PRIMARYKEY
where tbTasks1.IsDelete = 0
|
|
|
|
|
This will give same result as op's Query...
The op's Query is using implicit inner join.
Rather than inner join, Left Or Right Join will work for op's requirement.
"Insanity is doing the same thing over and over again but expecting different results.” — Rita Mae Brown
"If you tell the truth, you don't need to remember anything" - Mark Twain
modified 19-Jan-12 3:59am.
|
|
|
|
|
V@rsh@ wrote: This will give same result as op's Query
No, it won't. There is a big difference between these two queries:
select * from tbDocument,tbTasks1
where
tbTasks1.IsDelete = 0
select tbDocument.*
from tbDocument inner join tbTasks1 on tbDocument.FOREIGNKEY = tbTasks1.PRIMARYKEY
where tbTasks1.IsDelete = 0
The first one is called a "cartesian join" and is almost always a mistake.
|
|
|
|
|
Agreed op has not used any condition to join both tables in the "Where" clause because of which it uses Cartesian product rather than Inner Join... My fault
But it will be same as
Select * from tab1
Inner Join tab2 on 1=1
where tab2.somefield=somevalue
So I think that was actually representing implicit inner join which uses cartesian product
"Insanity is doing the same thing over and over again but expecting different results.” — Rita Mae Brown
"If you tell the truth, you don't need to remember anything" - Mark Twain
|
|
|
|
|
Try this Query :
Select * from tbDocument
Left join tbTasks1 On tbDocument.Column=tbTasks1.Column and tbTasks1.IsDelete = 0
Your Query is using implicit inner join & inner Join by default applies condition (Filters) on Both tables. You need to use Left Join Or Right Join for you requirement.
"Insanity is doing the same thing over and over again but expecting different results.” — Rita Mae Brown
"If you tell the truth, you don't need to remember anything" - Mark Twain
|
|
|
|
|
I'm not sure what you mean when you say that you don't want any rows from tbTasks1. I assume that you mean that you don't want to see the tbTasks1 columns in your result set. In which case you should specify which columns you want, something like:
select tbDocument.col1, tbDocument.col2, tbDocument.col3
from tbDocument inner join tbTasks1
on tbDocument.aKey = tbTasks.aKey
where tbTasks1.IsDelete = 0
Edit: which I've just realised is exactly the same answer Damian gave earlier. Doh!
|
|
|
|
|
if both the tables having same structure
u can use
select * from tbDocument
union all
select * from tbTasks1
where
tbTasks1.IsDelete = 0
|
|
|
|
|
You could use
SELECT Col1.T1, Col2.T1, Col3.T1
FROM table1 T1 join table2 T2
ON T1.Col1=Coln.T2
OR
SELECT Col1.T1, Col2.T1, Col3.T1
FROM table1 T1
WHERE COL1 in (SELECT Col1 FROM table 2 where Coln=something1 and colm=somethingelse and yadayada)
|
|
|
|
|
Hi all,
Facing this weird error message,
---
Msg 601, Sev 12, State 3, Line 1 : Could not continue scan with NOLOCK due to data movement. [SQLSTATE 42000]
---
It happens during an insert:
INSERT INTO my_table(field1, field2)
SELECT field1, field2
FROM v_my_table WITH (NoLock)
If anyone has any insight that would be much appreciated!
Thanks for your time!
|
|
|
|
|
Wikipedia may be in a black-out but google isn't.
Anyway, I found this[^]
|
|
|
|
|
Remove the NOLOCK; the insert is messing up some reads.
Bastard Programmer from Hell
|
|
|
|
|
Hi all,
I've often wondered about this and always simply worked my way around the issue but I would be curious to know what the correct approach is.
Say I have a stored proc like so:
CREATE PROCEDURE myStoredProc
@myFirstParam INT = 0,
@mySecondParam INT = 0
AS
BEGIN
END
Now I want to call this proc, let's say from another proc where there is a local variable with the name @myLocalVar . I want to pass the value of that local variable to the second parameter of the stored proc so I call it as follows:
EXEC myStoredProc @mySecondParam = @myLocalVar
So far so good, but what if the name of that local variable was @mySecondParam (the same as the parameter name of the proc)? The following won't work:
EXEC myStoredProc @mySecondParam = @mySecondParam
So do I really have to create a new local variable with a different name so that I can pass it to the proc?
DECLARE @myNewVariable INT;
SET @myNewVariable = @mySecondParam;
EXEC myStoredProc @mySecondParam = @myNewVariable
Or is there a way I can pass a variable to a proc if the variable has the same name as the parameter name of the proc?
PS. I'm deliberately using an example where the first parameter of the proc is ommitted because I'm specifically interested in the scenario where the parameter names of a stored proc has to be specified (i.e. not inferred by their order).
|
|
|
|
|
This works for me, local and procedure variable is the same.
DECLARE
@ContentTypeID INT
SET @ContentTypeID = 4
EXEC dbo.ContentTypeSelect @ContentTypeID = @ContentTypeID
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
How silly of me. I simply assumed that EXEC MyProc @MyParam = @MyParam wouldn't work. Just tested it and no problem at all.
Thanks.
|
|
|
|
|
|
You do know that you can just list the input values without specifying the parameter name right?
Thus your example becomes.
EXEC myStoredProc @mySecondParam
|
|
|
|
|
Hi
I created one web form and i need to insert all same record more than 10 times using Mysql query. How to insert same record multiple times in Mysql using single query and not using for loop. If anybody knows, please reply me.
one more thing
in Sybase some people sujjesting to go for GO command like
insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working
Thanking you,
modified 16-Jan-12 6:44am.
|
|
|
|
|
Your question doesn't really make any sense. Why don't you want to use a for loop ?
You can always issue 10+ same statements to do your insert, but then what's the point to do it this way ?
No memory stick has been harmed during establishment of this signature.
|
|
|
|
|
in Sybase some people sujjesting to go for GO command like
insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working
|
|
|
|
|
with out knowing what you code is like and how you are inserting your data have you considered a union statement?
MySQL Union[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|