|
Hi,
I have one SQL query, i want to update it in one database. Please check that SQL query below.
update employee set emp_name = 'Ravi' where emp_id = 1
Now i want to get the count of how many rows get updated..
Can any one help me out as it urgent requirement for me..
Thanks
John.
|
|
|
|
|
ExecuteNonQuery would do that if you are speaking of managed C++.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
|
I always use stored procs but this may work.
update employee set emp_name = 'Ravi' where emp_id = 1; Select @@Rowcount Updated
Not sure if it requires a colon or a semi colon.
|
|
|
|
|
Hello Holmes,
Yes, you have given exact query.. i have executed this query in QueryAnalyser it is working fine and this what i am expecting..
Can you please explain me how to execute this query through VC++..?
Thanks
John.
|
|
|
|
|
Sorry, I wouldn't know VC++ if it wandered up and bit me, I suggest you take it to the language forum.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi!
I have recently published a website to a Windows 2008 x64 Server with SQL 2005 Express Edition. I am able to logon to the website but when I navigate to view employees for instance then I get the error 26 message.
I enabled the TCP/IP and Named Pipes Protocols, added SQL browser.exe to the firewall including port 1433 and 1434. I also checked to make sure SQL Browser is running.
Does anyone have any suggestions?
Illegal Operation
|
|
|
|
|
|
|
Hi Friends,
i am trying to refresh a data base where i need to authenticate the user first with something similar window as we see in SQL client.
can somebody help me here..
Thank you very much!
vikas da
|
|
|
|
|
So you are after a logon screen, try searching CP or Google, there are hundreds of examples. You should probably be asking this in the forum of your language choice (C#, VB, C++ etc).
|
|
|
|
|
|
Respected,
How can we truncate the whole tables value from my DataBase by single query.
Thanks
|
|
|
|
|
truncate table tblName
Niladri Biswas
|
|
|
|
|
Drop database: The DROP DATABASE statement is used to delete a database. Everything is deleted ... tables, views, indexes, stored procedures, etc
Drop Table: The DROP TABLE statement is used to delete a table.
Truncate Table: Delete the data inside the table, and not the table itself
Use this as reference:
http://www.w3schools.com/SQl/sql_drop.asp[^]
|
|
|
|
|
Respected,
But I have given the Relations to Tables.
Thanks.
|
|
|
|
|
Then do it one table at at time, starting from the leaf tables...
eg:
Persons have one or more Addresses. Delete Addresses first, then Persons.
|
|
|
|
|
You could have specified that in the post.. How can one come to know that you want to perform a CASCADE DELETION ?
e.g.
CREATE TABLE tblPK
( id int primary key )
CREATE TABLE tblFK
(id int,
name varchar(50),
age int
FOREIGN KEY (id) REFERENCES tblPK ON DELETE CASCADE)
Niladri Biswas
modified on Wednesday, November 4, 2009 12:51 AM
|
|
|
|
|
In 20+ years of database design and development I've never actually used cascade delete, I wonder why!
|
|
|
|
|
Mycroft Holmes wrote: I wonder why!
Because you are scared of it?
|
|
|
|
|
I always envisage someone going to the settings table and using cascade delete on the Standard Customer record or something. Scared does not even cover it, terrified is closer.
|
|
|
|
|
Meh... don't let users have access to the tables... have a good backup strategy!!
|
|
|
|
|
Thats even the worst side effect.
Imagine a header table with, lets say, 1000 records in it. Each header has 100,000 (badly indexed) child records. Cascade delete is turned on.
Someone comes along and says "Ah header table only has 1000 rows, it will be easy to delete a record from there".
Database reduced to treacle.
|
|
|
|
|
Probably for the same reason as I haven't - we are control freaks who like to explicitly delete things when we want to, not sudenly finding it happening 'on its own'
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
hello
SSRS - web service interface generated pdf's with slightly different font/color compared to those pdf when access via "Direct URL access" (point browser to http://localhost/reports/SomeReport/SomeReport - then export by pdf).
Any idea why? Perhaps it has to do with DeviceInfo in Render method? What do I need to do so two are same?
Thanks
dev
|
|
|
|