|
Help!
I have a table with a column named "Device Names" and a column named "Total Calls".
I want to COUNT these columns and display the top 10 devices according to the device names. How will I go about doing this?
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
select top 10 DeviceName, sum(TotalCalls) SumCalls
from MyTable
group by DeviceName
order by 2
|
|
|
|
|
I want to wight a programm in (VB.net C#)for data transfer Client to Web Server; i have bulck data on my Client PC and i want to Upload all Data on Web Server less time consuming. (using C# code)?
Can somebody hepl me ????
please give me a right solution with well manar.
Pavan Pareta
|
|
|
|
|
Hi All,
I have been using full text search(Sql Server 2000)in my application for search purpose.
But on certain words i.e Noise words such as And,after,about i am receiving the following error:
Execution of a full-text operation failed.A clause of the query contained only ignored words.
I tried a lot to sort out this issue,but this is going to be out of my scope.
If anybody can help me then it would be really appreciable.
Thanks in Advance,
Vivek Rathore
|
|
|
|
|
Hello, I am using VB Net(2003). I’m asking questions, Namely: Here I have a data base under Access in the name of Invent.mdb, which contains 2 tables TreeviewItems and Products. The Products table has close to (1000) recordings and about (30) fields. On my (Form1) are TreeView, DataGrid and ListView. Operation Mode : At the starting, load the treeView with the TreeviewItems table, and on a node click of the TreeView it fills the Datagrid, and upon a new node click from the same Treeview it does empty the DataGrid and does re-fill it. It does that as long someone clicks on a treenode. Up to here all ok, I have a (2e) form (Form2) which opens on a click of button, this form contains Textboxes which are automatically fills (Data Binding of Data Grid Form1) here my question I would like to be able to add, modify, to remove recordings from my table Products, as I mentioned at the beginning, the Products table contained nearly 1000 recordings. thus Ref_ID column is label from 1 to 1000, assume to illustrate this example that DataGrid contains 32 recordings and which have for Ref_ID the reference label 110 to 142 and since that fields is the primary key which autoincriment . If I want to add a recording it will thus have the number 143 and at the time of the update how that will be done it cannot y have doubled blooms. See my dilemma, I hope to have been rather precise and that that someone will be kind enough to help me to see clearly. Thank you and waiting for advice.
|
|
|
|
|
andy38 wrote: thus have the number 143 and at the time of the update how that will be done it cannot y have doubled blooms
The ID should be set as an identity field in the database, when you create one, the data base should assign and return the ID. Your user should never enter it in, and it may not even be appropriate for them to see it or know it's there.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I have a question in regards to dynamically creating a cross tab query in sql server 2005. I have a table that contains the attributes of a product see below and I want to format is so that the outputs the product attributes to different columns with the corresponding values. I am using sql Server 2005 and have seen examples with using PIVOT function which does similar to what I want but they all the examples seem to use in circumstances where it is required to aggregate values in a column eg, sum a sales figure.
I could create a separate query for each attribute of a product and then use a join to get my result but this is not dynamic, i.e. if I add a new attribute I would have to change my query.
Can anyone help?
Before
Product Attribute AttributeValue
Apple Color Red
Celery Color Green
Banana Color Yellow
Apple Type Fruit
Celery Type Vege
After
Product Color Type
Apple Red Fruit
Celery Green Vege
Banana Yellow
|
|
|
|
|
can any one tell me, i got error like this
when i press f5 , it says unable to start debugging,then i run without debugging.
error:The 'oraoledb.oracle' provider is not registered on the local machine.
aslam
|
|
|
|
|
Looks like you need to go into debug mode, and register your oracle provider.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi all,
Here's a situation. I have table A which has several subclassed tables, say A1, A2, and A3. Table A has a primary key named foo which will only exist once in one of the subclassed tables. Now, I want to do a select statement to grab foo from table A and where ever it might be in the subclassed tables. Is it possible to write a single select statement instead of having to write 3 seperate select statements to get to the subclassed data?
Thanks,
Keith
|
|
|
|
|
You would normally use the following:
select A.*, A1.*, A2.*, A3.*
from A
left outer join A1 on A1.id = A.id
left outer join A2 on A2.id = A.id
left outer join A3 on A3.id = A.id
where A.id = 'foo' This will only return one row - the outer joins will either return proper field values (for the appropriate sub-class table) or nulls (for the inappropriate ones).
Regards
Andy
|
|
|
|
|
Thanks, Andy. That seems to do the trick. I'm curious though, as you add subclassed tables, would performance degrade significantly? I'm using SQL Server 2000. I'm not too worried about performance right now but it's something that would be good to know.
Thanks,
Keith
|
|
|
|
|
As long as each of the tables involved have a unique index or PK constraint (preferably clustered) specified on the key column the query should perform well. I would say that the problem comes with the maintenance effort required to add subclassed tables to all of your queries. I try not to overuse this design for that reason, rather than for performance.
An alternative common design that may perform better would be to merge all of the sub-classed tables into the ancestor table.
If you are worried about performance and encapsulation then you might consider using a hybrid of the two designs - so that the most commonly-used information is merged into the ancestor table, with the sub-classed tables only required in exceptional cases.
Like many design decisions - there is no right or wrong answer
Andy
|
|
|
|
|
I totally agree about the maintenance issue that arises from having so many subclassed tables in such a query. I began to explore a different path and ended up not going with huge query that you suggested. I'm trying my "bestest" to do an n-tier approach and that huge query didn't fit right with what I had. Though who knows if I'm doing it close to right. lol
Thanks again.
Keith
|
|
|
|
|
hi all
I have an table
CREATE TABLE [MultyItemsTab] (
[MultyId] [int] IDENTITY (0, 1) NOT NULL ,
[SingleId] [int] NOT NULL ,
CONSTRAINT [PK_MultyItemsTab] PRIMARY KEY
(
[MultyId],
[SingleId]
) ON [PRIMARY] ,
...
)
GO
And i want to save into one xml-based data
<br />
...<br />
set @txt = '<ROOT> <Style SingleId="0"/><Style SingleId="1"/> </ROOT>'<br />
<br />
EXEC sp_xml_preparedocument @idoc OUTPUT, @txt<br />
<br />
insert into MultyItemsTab select * from openxml(@idoc,'/ROOT/Style',0) with (SingleId int)<br />
<br />
...
And as a result in a table added 2 rows;
-----------------
MultyId-------------SingleId
0-------------------0
1-------------------1
But actually i want what MultyId indent not increase when add rows to this table at once.
I mean what desirable result is:
-----------------
MultyId-------------SingleId
0-------------------0
0-------------------1
How i can do this????
THANKS
-- modified at 10:16 Thursday 1st February, 2007
|
|
|
|
|
Calling by the other way:
Is it possible to call a stored procedure WITH PARAM from .net WITHOUT using "AddParams" ? I mean we should be able to call(exec) the SP just like we do in the query analyser. I'd construct the string like "sp_testproc '111','RR',23'". and execute it as nonQuery. Is there any way? please help.
*
|
|
|
|
|
Theoretically you could do this by setting the CommandType to Text and then issue the command directly. I would strongly advise you against doing this however. This is not a good design, and it is certainly not a robust or secure design. By passing in parameters as part of a string, you open yourself right up for Sql Injection attacks.
I cannot see any reason, apart from convenience, why you would do this. Use command parameters - they are much better for your needs.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Any trick of using Select TOP in dataset to datatable. I know that we can have a select TOP in the query but that is currently infeasible in my case since datasource does not support that. Also this is for .NET framework 1.1.
Any clues?
|
|
|
|
|
Hi Deepak,
u can use the following query to select teh datarows in f/w 1.1.
DataRow[] arrDRow = ds.Tables[0].Select("Top 10");
this returns an array of datarows with the criteria specified, which you can manipulate as required.
Let me know if that works.
Regards
Deepali
|
|
|
|
|
Missing operand after 10 operator
|
|
|
|
|
Hi All,
I have a question for you?
I have to pass 7 parameters to the procedure.
for some parameters i am not passing a value.
how to do this?
sivamyneni
|
|
|
|
|
You need to supply defaults for each of your optional parameters:
create procedure MyProc
@Param1 varchar(10) = null,
@Param2 int = null,
@Param3 date = null
as begin
set nocount on
--do stuff
return(0)
end
go
exec MyProc
exec MyProc 'hello', 123, '1 feb 2007'
exec MyProc 'world'
exec MyProc @Param3 = '1 feb 2007' Hope this helps.
Andy
|
|
|
|
|
Hi
I tried that one i am not getting proper result because none of my field contaains null value.so i am not getting the desired.
sivamyneni
|
|
|
|
|
Try this:
If Your procedure is like following:
ALTER PROCEDURE myProcedure<br />
@Param1 int = 0,<br />
@Param2 int = 0, <br />
@Param3 int,<br />
@Param4 int = 0,<br />
@Param5 int = 0, <br />
@Param6 int,<br />
@Param7 int<br />
<br />
<br />
AS<br />
<br />
<br />
-- Procedure code
In order to call it (say, from another sp):
exec myProcedure @Param3 = @PassedParam1, @Param6 = @PassedParam2, @Param7 = @PassedParam3
Note: Initialize parameters in the original procedure if you are not sure, the procedure will get those parameters passed to it. (In the case above, if you will not pass one of the @Param3, @Param6, or @Param7) the error will happen.
Hope that helps.
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
hi,
i need some help regarding data access from XML sent by web services.
I have a web service that sends out XML as its result, as below:
<?xml version="1.0" encoding="utf-16"?>
<Response webMethodId="GetUserListing">
<SecurityContext sessionId="154oe1upayjpnx55pg1f3r45" />
<Document>
<ArrayOfUsers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<User>
<UserId>32</UserId>
<Name>foxtrot</Name>
<Address>Suite 712</Address>
<Zip>12345</Zip>
< PhoneNumbers>
<string 111-111-1111/>
</PhoneNumbers>
<Emails>
<string>foo@foo.bar</string>
</Emails>
</User>
</ArrayOfUsers>
<TotalRecords>25</TotalRecords>
</Document>
</Response>
In the RDL file, the Query i specify is:
<Query>
<Method Namespace ="http://tempuri.org/" Name = "ProcessRequest" ></Method>
<SoapAction>http://tempuri.org/ProcessRequest</SoapAction>
</Query>
and the result i get is in a single line that says ProcessRequestResult, with the XML specified above in a single line. however, i need the result in a tabular form, which would give me records of different users, one below the other.
if i specify the <ElementPath> element for the query, i do not get any response at all.
The <ElementPath> element i specify is:
<ElementPath>Response{}/SecurityContext{}/Document{}/ArrayOfUser{}/User</ElementPath>
i need urgent help for this and any help would be appreciated.
Thanks in advance
Deepali
|
|
|
|