|
pankajdaga wrote:
Also, there is no auto-numbering in Oracle the way SQL Server has it.
Oracle relies on Sequences for autonumbering - similar, but the Select My_Sequence.nextval from dual had to be used....apologies if you already knew that one lol!
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Yeah, I found that out online. But thanks for pointing it out to me. I was never a database fan. After using Oracle tools I came to the realization that the job of a database administrator is one that I will never take
Also, all the limitations on the length of tables names and other identifiers is something I found strange. Probably something that has dragged on since the days of the first release. It is about time they removed these non sensical limitations.
Cheers,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
hello every body
i have a small question
How can I insert a row using values from binded text boxes without supplying every column value of my DataRow
Best Regards
UsamaDBA
|
|
|
|
|
Can anyone tell me how to get the number of rows affected by select query using datareader.when we insert,update or delete we can get the number of rows affected,but not when we use select query.So can anyone help me urgent
problemguy
|
|
|
|
|
I've solved this problem once in an ugly way:
I wanted to give back the total number of rows but return only the first 100. So I created a stored Procedure that made first the query with select count(*) and then the same query but with the needed columns and as the last column the result of the first query.
ex:
declare @num as int<br />
select @num = count(*) from Users where groupID = 10<br />
<br />
select top 100 username, address , @num from Users where groupID = 10
Hope this helps a little bit
Greets
Roland
|
|
|
|
|
The datareader does not know the number of rows until it gets them all. If you really need the (expected) number of rows, run a SELECT COUNT(*) query.
my blog
|
|
|
|
|
One way to do it is to put in a return field which counts the records that are returned. For instance add Count(FIeldName) As RowsAffected as one of your fields. This will however return an extra field for each row, which may not be a good idea.
The reason there is no way for the datareader to know how may rows are returned is that it is still connected to the data and not all rows are retrieved yet.
You could count the rows as you use them, through a loop, or if you bind them to a control, count them that way.
hope this helps,
sivilian
|
|
|
|
|
i am using ms access 2000 as database and i want to calculate salary of the employee on hourly basis. in database a field contain daily working hour in "HH:MM:SS" format.Now i want take sum of whole month time.
Here I have no idea how to take the sum of the time when the format is "date/time".output should must in the format of "HH:MM:SS"
Thanks
|
|
|
|
|
If iam making a table of location in that table i have columns city,county,condition. And i had some values added in these columns..
after addeding the values in these three columns now i want to add the new column temperature by
alter table location add(tempareture number(2));
but i want to add the values from start in this new column how that is possible is that possible for 1st column value as follow..
insert into location(tempareture) values(34) where city='Athens';
like that in other columns i can put the value tempareture????
please tell me solution..
Raj Khatri
|
|
|
|
|
seems you need to update not to insert
update location<br />
set tempareture=34<br />
where city='Athens';
|
|
|
|
|
Hi all the experts in Code Project,
I've a problem with returning the value returned by ExecuteScalar function under OleDbCommand. Here is a code sample.
...
cmd.CommandText = searchSqlstr;
long result = Convert.ToInt64(cmd.ExecuteScalar());
connection.Close();
return result;
Is there a way to rewrite this code so that I DO NOT need the 'result' variable?
since we always have to close the connection, if I write:
return Convert.ToInt64(cmd.ExecuteScalar());
it would be a bad idea right?
So is there a trick to do this?
Thanks a Lot
|
|
|
|
|
cmd.CommandText = searchSqlstr;
try
{
return Convert.ToInt64(cmd.ExecuteScalar());
}
finally
{
connection.Close();
}
Better yet would be a using(){} statement for the connection object, so that it will automatically be disposed, but since you didn't list all the code from instantiation to disposal, I can't reacreate it accurately.
using (SqlConnection connection = new SqlConnection(connString))
{
connection.Open();
try
{
SqlCommand cmd = connection.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = searchSqlstr;
return Convert.ToInt64(cmd.ExecuteScalar());
}
finally
{
connection.Close();
}
}
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Ah! Great tip! totally forgot about the using statements
Thanks a Lot!
|
|
|
|
|
In the example given, the connection.Close(); is redundant, since the using block will take care of that. Which makes the try-finally is also redundant, (unless you want to implement a catch). So a simple version is:
using (SqlConnection connection = new SqlConnection(connString))
{
connection.Open();
SqlCommand cmd = connection.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = searchSqlstr;
return Convert.ToInt64(cmd.ExecuteScalar());
}
my blog
|
|
|
|
|
Hi, I tried the c# forum, but this might be better. How do I programatically get table names from a .mdb file? There doesn't seem to be a way. I'd like to be able to open any .mdb file, read in the list of tables, etc.
Thanks for any help or tips.
Brian.
|
|
|
|
|
There are a couple of ways to do it....
One way is to use ADODB.Connection.OpenSchema method - returns a recordset with table names and characteristics if specifying the adSchemaTables flag
Other way is to use ADOX - Create a Catalog object, give it an ActiveConnection and it exposes a Tables collection - useful for seeing what's there and also modifying schema info...
As for doing it in .NET - no idea! SUspect that ADO.NET will support the above, but worth checking lol
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
The problem description goes like this...
person A is accessing a record to update, i want this record to be locked till the person A finishes his updation.
i want this to be implemented at BLL(Not IN database)
Regards,
|
|
|
|
|
Use distributed transactions.
However, you'll have to create locks on the records somehow on the database. By default, SQL Server only creates a shared lock on a row/page when it's involved in a SELECT statement.
If it's a simple, one-query update statement, SQL Server automatically locks and isolates the record until the query is committed.
*Edit: I read below where you responded and indicated that you use Oracle. Not knowing much about Oracle or PL/SQL, I'm going to quit bothering you with my platform-specific opinions.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Grimolfr wrote:
SELECT * FROM user WHERE clue IS NOT NULL<br />
GO
(0 row(s) affected)
I hope clue is indexed - it could take quite a while with over 6 billion rows.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
I'm using VB.Net. My users will fill out an Excel spreadsheet I made for them, then send it back. Upon sending it back, is there a way to automate it into a tSQL database?
Thank you for any help!
|
|
|
|
|
|
Ok, DTS looks good once it's there. What's the best way to send it to the server from the web form? Code would help, I'm new at this stuff.
Thanks again!
|
|
|
|
|
Dear friends,
This question is related to SQL queries.
I have two tables in SQL Server Database. Both of these tables have a column "eMail" which is of type varchar(). The emails may be repeated in a table, and an email present in one table can be present in the other table too.
Now i want to create another table with a column "eMail" in it. I want to copy all the eMail addresses of the above two tables in third table. But in such a manner that all emails entered in third table are distinct.
How can i do this with SQL queries ?
Imtiaz
|
|
|
|
|
insert table3(email)
select distinct email from table1
union
select distinct email from table2
...should do it. The key is union , not union all , which would not return distinct values.
my blog
|
|
|
|
|
Hello,
I am having some trouble with the SQLPlus tool over the command line.
Here is what I do:
on the command line I give the command:
sqlplus /nolog @c:\mycommands.sql
The mycommands.sql file contains:
CONNECT sys/syspass@mydatabase as sysdba
spool c:\output.txt
Select * from some_table
spool off
exit
However, the command line only shows the message connected and does not exit. The spool file also contains no information. I want it to execute the command and quit SQLPlus.
I hope someone can help me.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|