|
"in the middle of the insert command there is an error would the code before it still be added?"
You can use sqlTransaction , and can rollback and commit transactions as well as can make commit points
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Best way to see which is performing fast is to profile the application. I will go with the first method with the modifications what PIEBALDconsult suggested.
Second method would be good in performance but it is hard to troubleshoot when you get error in one of the inserts.
neodeaths wrote: also if lets say way 2 somewhere in the middle of the insert command there is an error would the code before it still be added?
Quote Selected Text
It will be added. If you want to ensure all the data gets added, run the queries in a transaction.
|
|
|
|
|
This is not a question, but feel free to reply if you have any opinion about the subject.
I have often seen the subject of this message as a question, here on CP, and having just found this article/blog (link below), I thought that I would post it here in case it is of use to someone.
If you follow the link, take the time to read the comments at the bottom as some of the views differ from those of the author.
Here it is.[^]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
In my opinion both Pinal Dave (well i really appreciates his efforts He is not doubt a SQL Guru ) and on the other hand users are right on their respective end.
i will also use Sql server if i am in Microsoft env. and tools while will def. go for mysql in case of php and linux/unix platform
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
softdev_sup wrote: i will also use Sql server if i am in Microsoft env. and tools while will def. go for mysql in case of php and linux/unix platform
I think that that is the right way to think about it too.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Does anyone know how I can create a report on reporting services that selects information from two databases on the same sql server?
Any help would be grateful
Michael
|
|
|
|
|
|
|
Aw, my aplogies, there's no need to create a linked server. You can just prefix the entities that you need to denote the database;
SELECT *
FROM [database].[schema].[table] E.g.;
SELECT *
FROM Northwind.dbo.Employees
I are Troll
|
|
|
|
|
|
hi
i have table that i want to change any field type (from int - to - varchar)
i get this error:
saving changes is not permitted........
|
|
|
|
|
Probably you get this error while you alter your table in design mode.. If so then you need to change setting form option... set allow auto generate sql script true.. If this issue still not resolve then please let me know...
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
thank's for the help
yes, i work in design mode.
but, where i can find this ...option... set allow auto generate sql script true ?
|
|
|
|
|
what are the data field sizes you are using to convert the field type you can use script as
GO
BEGIN
ALTER TABLE tbl ALTER COLUMN [fld] [varchar](18, 8) NOT NULL
END
GO
or create another field as varchar and update your data of numeric fld to it and then drop old column
you can also use casting
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Hi All,
I am getting a strange error while establishing connection with sqlserver.
i written the following code to establish the connection
string sqlStatement = "select * from Student_Table";
String dataBaseConnection = "Data Source=DREDDY9/SQLEXPRESS;Initial Catalog=SampleDataBase;Integrated Security=SSPI";
SqlConnection myConnection = new SqlConnection(dataBaseConnection);
SqlCommand myCommand = new SqlCommand(sqlStatement, myConnection);
SqlDataReader dr;
myConnection.Open();
dr = myCommand.ExecuteReader();
if(dr!=null)
{
Response.Write("Successfully Executed");
}
myConnection.Close();
To resolve this i tried with enabling local and remote connections and i enabled sql server browser.
but no use
any body is having any solution. please shere it.
|
|
|
|
|
What is the error?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
what kind of error you are facing are you enable to connect if so then try
Data Source=./SQLEXPRESS instead off Data Source=DREDDY9/SQLEXPRESS
also check your protocols you are connecting with tcp/ip or named pipes and the user from which you are going to connect should have rights to connect to the db.
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
look out for slash it should be \ not /
Data Source=DREDDY9/SQLEXPRESS;
Data Source=DREDDY9\SQLEXPRESS;
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
I have the following table (ccpoc)
poc_cod varchar(10)
poc_cod_asc varchar(10)
poc_desc varchar(40)
With the following data
poc_cod poc_cod_asc poc_desc
1 12 Coiso
1 13 Coisa
1 14 Coisinhas
And I'm trying the following query
UPDATE ccpoc SET poc_cod='133', poc_cod_asc='13', poc_desc='Coiso 133' WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1'
I'm querying the server with an ExecuteNonQuery in C#, and everything seems to go fine. No errors, no exceptions, everything runs well. The problem is that data in the table does not change!
Anybody has any idea what might be happening?
Best regards
Fratelli
|
|
|
|
|
I guess you should give a try to these:
1. Run SQL profiler to see what query is actually run on your table.
2. Run a select statement with same where clause to check if there are any rows matching the criteria.
3. If you are using transactions, check if you have committed it or not.
4. Does the same query when run through Management studio works?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
AndreFratelli wrote: WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1'
none of the records shown match this.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Yes, I noticed already. Lame mistake
Fratelli
|
|
|
|
|
With the following data
poc_cod poc_cod_asc poc_desc
1 12 Coiso
1 13 Coisa
1 14 Coisinhas
And I'm trying the following query
WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1'
in your abv given data their is no row having poc_desc='Coiso 13' , so how come will it update, no doubt the results would be zero.
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Hi,
I have a c# application that uses a MySql database, the problem that after a period of inactivity (8 hours) or when connection to the server where database is host is lost, the connection to the database is closed and database queries cannot be executed. how can i enable the auto reconnect to the database.
Best regards.
Keep it simple, stupid!
|
|
|
|
|
Through a Timer in your C# code.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|