|
Hey all,
how do I update table1 depending on its relation with table2 and table3?
eg.,
UPDATE table1 SET table1.col1 = (SELECT table4.col1 FROM table4 WHERE table4.col2 = "asdfgf" ) WHERE table1.col2 = table2.col1 AND table1.col3 = table3.col1
Is the above correct?
Or should I use JOIN to do the above? If so, how do I do it?
Can anyone help?
Thanks in advance.
|
|
|
|
|
As far as my knowledge goes, I guess the above query should work as expected. A join is not needed in this case. A join is needed only when you need to combine data from multiple tables based on certain criteria.
G.Meena
|
|
|
|
|
Can anybody help ?
This is ASP.Net code
I'm trying to send Null value to stored procedure
and this can be done like this:
...
cmdInsert.Parameters.Add( "@test_var", DBNull.Value )
...
Question
How this can be done with old ASP code
If I try something like this I got error
...
Set objParam = objComm.CreateParameter("@test_var", adVarChar, adParamInput, Len(test_var), Null)
objComm.Parameters.Append objParam
...
How can I do this?
Is there in old ASP code something like "DBNull.Value" in ASP.Net
Thank u
M
|
|
|
|
|
how can i build an interface to my database
undercharm
|
|
|
|
|
undercharm wrote: how can i build an interface to my database
I think you get the prize for the most vague question of the day.
What database are you using? Is it a commerial offereing? If yes then it may already have .NET providers. Is it a database engine you created yourself? Then you will have to read up on Data Providers (The interefaces in the System.Data namespace will be a good referrence)
|
|
|
|
|
I have two database : Db1 and Db2
I want to fill tables of Db2 with some fields of Db1 tables
also I do`nt want to use from Import & Export wizard
do you have any idea
Hello Friends
|
|
|
|
|
If they're on the same server, you can prefix the owner.tablename with the database. So, suppose that you had Database1.dbo.MyTable and Database2.dbo.MyTable, you could do the following (as an example):
INSERT INTO Database2.dbo.MyTable<br />
SELECT * FROM Database1.dbo.MyTable
Obviously, you will need the relevant permissions in both dbs to do this.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
My database table consists a Field (Called ApplyDate)store the integer data, like "20061122" represent 22 nov 2006. i need to filter the data for whole November 2006, but if i write SELECT....WHERE ApplyDate = 200611 , it cannot get the data out because the last two digit no specified. So , how i write the SQL Where statement if i want to select Whole Nov 2006 ? (for example, 20061101...20061130 also acceptable)
Best regards,
Chee ken
|
|
|
|
|
why dont you use like command
example
SELECT....WHERE ApplyDate like '200611%'
this will give you proper result
|
|
|
|
|
Thanks for your reply. I also have thinking using LIKE , but if the date is 20200611(11 Jun 2020 ), then my data is getting wrong already ! aLthough the date is many years later, but i just thinking have any other way to get the correct data, any idea ? thanks.
Best regards,
Chee ken
|
|
|
|
|
"Where ApplyDate >= 20061101 and ApplyDate < 20061201"
|
|
|
|
|
I have Created a FullText Indexed table to store the Doc files.
I want querying the DocAuthor,Size, etc.. from Full Text catalog, not from OS Physical file.
I am using Sql Server 2005.
Regards
Fenil
|
|
|
|
|
please, with code and thank u another time
|
|
|
|
|
|
|
|
You're welcome.
BTW, it is customary to just replay to the same post, rather than staring a new one. That makes it much more likely that the person you are replying to will actually see the post, since replying sends an anonymous email. If you create a new psot, it may scroll off the current page long before the person you are addressing revisits that forum.
|
|
|
|
|
Thank you Christian Graus but please, explain your answer as i am beginner and give me an example.
|
|
|
|
|
To rephrase Christian's answer:
1. create a table with a field of type LongVarBinary to hold the wave file (a blob field)
2. read the wave file into a byte array.
3. store the byte array in the LongVarBinary (blob) field using a parameterized query, with the byte array as the value of the parameter.
|
|
|
|
|
please,how can i insert wav data type " audio files " in sql server 2000 database ?
|
|
|
|
|
As binary data, probably a blob
Christian Graus - C++ MVP
|
|
|
|
|
im trying to create a get records function that searches the database for a value and returns all records that match that value. I originally had to working with pure sql, but my professor said i should make my function use parameters. My problem is searching strings. In my original sql statement i used the following to search for strings.
sqlString = "SELECT * FROM " & genTable & _
" WHERE (((" & genTable & "." & field & ")Like'?%'));"
My ill attempt to create a parameter based is as follows
sqlString = "SELECT * FROM " & genTable & _
" WHERE " & field & " Like '?%'"
Any ideas on whats wrong ???
|
|
|
|
|
Whoah. Don't go there. Do not do a query like that EVER. This just cries out for a SQL Injection attack. Search for Colin Angus Mckay's article on SQL Injection to see why this is a really bad idea.
I suspect that the parameters that your professor was talking about were SqlParameters (assuming that this is a .NET application) or some similar.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hey everyone, im a little stuck here
basically i have a SQL 2000 function like this:
<br />
CREATE PROCEDURE GetTaskListForSupervisor<br />
as<br />
declare @rowcount int<br />
set @rowcount = select count(id) from TimeStudy<br />
<br />
GO<br />
Obviously, that doesnt pass the syntex check, but can you see what id like to do? just put the count of all the rows into a locally declared variable? Im a bit out of my depth here so could someone pull me back into shallow waters please
Cheers
Will
|
|
|
|
|
"select @rowcount = count(*) from TimeStudy" ;no advantage to count(id) over count(*)...
|
|
|
|