Query To Get The Maximum Occurred Value?

Apr 4, 2008

 
hi...
i need a stored procedure query to get the maximum occurred value ie(more than one time occurred value)....
 this is my table structure....
 table Name: PHOTO_GALLERY_VISITS

pgv_id
   pgv_main_category_id      pgv_sub_category_id            pgv_path  
                                               pgv_visitor_id     
pgv_visited_date
    6                    54                   
                     72             
photo/Writer/Content/Mobiles/LG/camer4.jpg          26                 
4/3/2008 6:41:02 PM
    7                    54                 
                       73             
photo/Writer/Content/Mobiles/Samsung/mobile1.jpg  26                
4/3/2008 6:41:43 PM
   8                     64                 
                       85              
photo/Writer/Content/Movie/Bachan/bhachan1.jpg         25              
4/4/2008 3:37:17 PM
   9                     63                 
                       82              
photo/Writer/Content/sports/Cricket/cricket1.jpg         34           
   4/4/2008 3:37:29 PM
  10                   
54                                          73              
photo/Writer/Content/Mobiles/Samsung/mobile1.jpg     34            
4/4/2008 3:37:29 PM
  11                   
54                                         73              
photo/Writer/Content/Mobiles/Samsung/mobile1.jpg      26           
4/4/2008 3:37:29 PM
12                     
54                                         73              
photo/Writer/Content/Mobiles/Samsung/mobile1.jpg      54            
4/4/2008 3:37:29 PM
 
13                    
54                                           72              
photo/Writer/Content/Mobiles/LG/camer4.jpg               59           
4/4/2008 3:37:17 PM
 
The above is my sample table...... In that filter the most occurrence based on the column "pgv_sub_category_id"
in the above table the 73 is the maximum occurred  id after that the second maximum ie..72 is the 2nd maximum occurred....
hence i want the output as only the id & path which occurred more than one time..... 
pgv_sub_category_id                                         pgv_path
73                                               photo/Writer/Content/Mobiles/Samsung/mobile1.jpg
72                                                photo/Writer/Content/Mobiles/LG/camer4.jpg
 
plz anybody send me the query....
its urgent.....
thanks in advance.....
regards
janu

View 4 Replies


ADVERTISEMENT

Transact SQL :: Error - Maximum Row Size Exceeds Allowed Maximum Of 8060 Bytes

Sep 12, 2015

I have some code I build 2 weeks ago which I’ve been running daily but it’s suddenly stopped working with the following error.

“The table "tbl_Intraday_Tmp" has been created, but its maximum row size exceeds the allowed maximum of 8060 bytes. INSERT or UPDATE to this table will fail if the resulting row exceeds the size limit” When I google this there seems to be a related to tables with vast numbers of columns.

My table tbl_Intraday_tmp is relatively small. It has 7 columns. 1 of varchar(5), 3 of decimal(9,3) and 2 of decimal(18,0). The bit I’m puzzled with is it was working and stopped.

I don’t recall changing anything but I wouldn’t rule that out. I ‘ve inspected the source files and I don’t believe they have changed either.

DECLARE              
@FileName varchar(50),
@Path varchar(50),
@SqlCmd varchar(1000)
= '',
@ASXCode varchar(5),
@Offset decimal(18,0),

[code]....

View 5 Replies View Related

Error - Maximum Row Size Exceed Allowed Maximum Of 8060 Bytes

Apr 20, 2012

I am using MS SQL server 2008, and i have a table with 350 columns and when i m trying to create one more column its giving error with below message -

Warning: The table XXX has been created, but its maximum row size exceeds the allowed maximum of 8060 bytes.

INSERT or UPDATE to this table will fail if the resulting row exceeds the size limit.

how can i resolve this?

View 14 Replies View Related

Min/Maximum Grouping Query

Jun 13, 2004

I know this has been posted before, but I can't find the previous threads so please bear with me....

I want to grab the very 1st record of each product in a table like this

ID CLIENTID PRODID
1 a 1
2 b 1
3 c 1
4 a 2
5 b 2
6 c 2
7 a 3
8 b 3
9 c 3

so that I'd get a record set like:

ID CLIENTID PRODID
1 a 1
4 a 2
7 a 3

Thanks for the hellp guru's

View 4 Replies View Related

Maximum SQL Query Lenght

Mar 6, 2006

Hi all!

Does anybody know what is subject?

Thanks!

View 1 Replies View Related

Arithmetic Overflow Occurred On Insert Query

Nov 24, 1999

Ok I'm doing a simple insert query:

insert into product(CategoryID, StoreID, MallCategoryID, ProductName, Manufacturer, ProductItemNumber, Size, Color, SizeApplies, ColorApplies, Price, Discontinued, ProductDescription, GiftWrapping, Gender, Age, MinAge, MaxAge, Tax, Shipping)
values(100, 100, 80, 'test product Casdfasdf', 'test manufacturer', 'est', '', '', 0, 0, 99.95, 0, 'test desc', 0, 'Both', '', '0', '0', 0, 0)

I get this error:

Arithmetic overflow occurred.

It dosn't make sense that this would happen because the number fields are not huge at all.

Any ideas...?

here's the table layout:

CREATE TABLE dbo.Product (
ProductID smallint IDENTITY (1, 1) NOT NULL ,
ProductName varchar (100) NULL ,
Gender varchar (10) NULL ,
ProductDescription varchar (255) NULL ,
Manufacturer varchar (75) NULL ,
ProductItemNumber varchar (50) NULL ,
Tax bit NOT NULL ,
Shipping bit NOT NULL ,
ApproxWeight varchar (10) NULL ,
MallCategoryID smallint NULL ,
GiftWrapping bit NOT NULL ,
ShippingCost decimal(18, 2) NULL ,
GiftWrappingCost decimal(18, 2) NULL ,
ImageName varchar (25) NULL ,
Price decimal(18, 2) NULL ,
SizeApplies bit NOT NULL ,
ColorApplies bit NOT NULL ,
Age varchar (20) NULL ,
StoreID smallint NULL ,
CategoryID smallint NULL ,
Discontinued bit NOT NULL ,
MinAge varchar (5) NULL ,
MaxAge varchar (5) NULL ,
Size text NULL ,
Color text NULL
)

THANKS!!!!

View 2 Replies View Related

Maximum UNION Statements In A Query

Dec 17, 2005

Wondering if there is a physical or realistic limitation to the numberof UNION statements I can create in a query? I have a client withapprox 250 tables - the data needs to be kept in seperate tables, but Ineed to be filtering them to create single results sets. Each tableholds between 35,000 - 150,000 rows. Should I shoot myself now?lq

View 15 Replies View Related

An Internal Error Occurred. [ ID = 3639 ] On Delete Query

Aug 1, 2007

Hi,
When I am trying to execute a delete query i'm getting the following error An internal error occurred. [ ID = 3639 ]. This is happening for some specific rows only. Other rows are getting deleted without any issues. Some 7 rows are there which i'm not able to delete. I am able to run update query on that rows. but not delete query
Pls help
Thanks
Nebu

View 7 Replies View Related

Unique Zip Code With The Category Having The Maximum Value (was Sql Query Help)

Nov 30, 2005

Hello,

I'm trying to select the maximim value for certain zip codes, for example my table looks like this:

ZIP Category Value
90210 S1 5
90210 S2 10
90210 S3 2
90210 S4 3
10221 S1 24
10221 S2 3

And I want the end result to be each unique zip code with the category having the maximum value, for example 90210 S2, 10221 S1, etc

View 4 Replies View Related

Maximum Length Of Return In Query Analyzer

Apr 13, 2006

I am executing a SELECT statement that has about 500 characters of literal characters concatenated with the contents of a field from a table. I am then storing the result to be run as dynamic SQL. I am finding that when run this as select statement in query analyzer, the last part of the literal gets truncated. When I run it as a cursor and store it in a varchar(1000) variable and print the variable everything works fine. In addition when I put the select statement in a stored procedure and return this to a ADO recordset, the resultset is fine as well. But running the stored procedure in query analyzer truncates the results as well. The issue seems to be getting the results of the SELECT in query analyzer. Even running the stored procedure in the SQL area of Enterprise Manager returns a proper result. Has anyone heard of a maximum return from a select in query analyzer?

View 4 Replies View Related

Maximum Number Of Databases Used For Each Query In 2005?

Mar 22, 2006

In MS Sql Server 2000, if you run a stored procedure that query's morethan 8 databases, you get this error gets raised:Maximum number of databases used for each query has been exceeded. Themaximum allowed is 8.In 2005, does this maximum number still exist? if so, is it still 8, orhas the number been increased?Thanks,Mike

View 2 Replies View Related

T-SQL (SS2K8) :: Query Maximum Concurrent Connections (Participants)

Mar 4, 2015

I have a table called dbo.PhoneCalls with below columns

PhoneID |PhoneNumber| Callstarttime| CallEndtime|
1 |111-111-1111|2013-04-01 05:13:03.000|2013-04-01 05:13:03.000
1 |222-222-2222|2013-04-01 05:15:12.000|2013-04-01 05:16:52.000
2 |333-333-3333|2013-04-01 05:17:29.000|2013-04-01 05:24:08.000
2 |444-444-4444|2013-04-01 05:21:50.000|2013-04-01 05:22:31.000
2 |555-555-5555|2013-04-01 05:22:41.000|2013-04-01 05:23:11.000
2 |666-666-6666|2013-04-01 05:23:20.000|2013-04-01 05:23:46.000
..........

1. PhoneID is nothing but the participant in the call. PhoneID = 1 is twice from above. Which means 2 particpants (Same call )with 2 numbers with their callstarttime and callendtime. Similarly for PhoneID =2, there are 4 participants. And the list goes on for a day and then for a month.

2. For example a phone call P1 with 2 participants is going on for a particular day. We should not consider the same phone call having 2 participants involved. So that the concurrency would be 2. We have to ignore that here.

3. Only to be considered is other Phone calls for that day. Lets say P1 having call with 2 participants, P2 having some 4 participants which fall in the time period of P1. Then we should consider P1 and P2 the common period

4. In order to find number of concurrent calls happened for a day basing on callstarttime and callendtime. What would be the query?

5. Should consider the Timeperiod or the bucket with 1 hour as the period.

6. A Phone Call P1, Phone Call P2, should have matching (common) time ( keeping all the scenarios) is required for this query.

Result for Concurrent calls for a day should be like below. Should get all the concurrent connections happened for a particular day.

Date|TimePeriod/Bucket(hr part)|Concurrentconnections|
Jan-01-2015|01 to 02|3
Jan-01-2015|11 to 12|2
Jan-02-2015|04 to 05|5
Jan-02-2015|12 to 13|13
........

ii) So once the above is achieved.

Have to find the Maximum concurrent connections for day from the above.

For below Maximum Concurrent connections are '3'
Date|TimePeriod/Bucket(hr part)|Concurrentconnections|
Jan-01-2015|01 to 02|3
Jan-01-2015|11 to 12|2

Hence the Result for Maximum Concurrent Connections would be

Date|TimePeriod/Bucket(hr part)|MaxConcurrentconnections|
Jan-01-2015|01 to 02|3
Jan-02-2015|12 to 13|13
.............

View 3 Replies View Related

An Error Has Occurred During Report Processing. (rsProcessingAborted).. Query Execution Failed For Data Set

Sep 11, 2007

Hi All,

I'm facing a strange problem..
I've developed few reports. they are working fine in develop environment. after successfull testing they were published on web.
in web version, all reports are executing for first time.. if I change any of parameters values or without chaning also..
if I press "View Report" following error occurs..




An error has occurred during report processing. (rsProcessingAborted)

Query execution failed for data set 'dsMLGDB2Odbc'. (rsErrorExecutingCommand)

For more information about this error navigate to the report server on the local server machine, or enable remote errors

please suggest any alternative ways to overcome this issue
thanks in adv.

View 11 Replies View Related

...Contains More Than The Maximum Number Of Prefixes. The Maximum Is 3.

Oct 10, 2005

SQL Server 2000 8.00.760 (SP3)I've been working on a test system and the following UDF worked fine.It runs in the "current" database, and references another database onthe same server called 127-SuperQuote.CREATE FUNCTION fnGetFormattedAddress(@WorkID int)RETURNS varchar(130)ASBEGINDECLARE@Address1 As varchar(50)@ReturnAddress As varchar(130)SELECT@Address1 = [127-SuperQuote].dbo.tblCompany.Address1FROM[Work] INNER JOIN[127-SuperQuote].dbo.tblCompany ON [Work].ClientID =[127-SuperQuote].dbo.tblCompany.CompanyIDWHERE[Work].WorkID = @WorkIDIF @Address1 IS NOT NULLSET @ReturnAddress = @ReturnAddress + @Address1 + CHAR(13)+ CHAR(10)RETURN @ReturnAddressENDSo now the system has gone live and it turns out that the live"SuperQuote" database is on a different server.I've linked the server and changed the function as below, but I get anerror both in QA and when checking Syntax in the UDF builder:The number name 'Zen.SuperQuote.dbo.tblCompany' contains more than themaximum number of prefixes. The maximum is 3.CREATE FUNCTION fnGetFormattedAddress(@WorkID int)RETURNS varchar(130)ASBEGINDECLARE@Address1 As varchar(50)@ReturnAddress As varchar(130)SELECT@Address1 = Zen.SuperQuote.dbo.tblCompany.Address1FROM[Work] INNER JOINZen.SuperQuote.dbo.tblCompany ON [Work].ClientID =Zen.SuperQuote.dbo.tblCompany.CompanyIDWHERE[Work].WorkID = @WorkIDIF @Address1 IS NOT NULLSET @ReturnAddress = @ReturnAddress + @Address1 + CHAR(13)+ CHAR(10)RETURN @ReturnAddressENDHow can I get round this? By the way, I've rather simplified thefunction to ease readability. Also, I haven't posted any DDL because Idon't think that's the problem!ThanksEdward

View 2 Replies View Related

How To Tell When The Last Restore Occurred?

Apr 12, 2008

I'm not sure this option even exists, but I hope it does. Is there a way to query SQL Server in order to find out when the last time a database was restored (Date/Time)?

If this can be done from C#, great, but I'll take whatever info you can offer.

-Todd Davis

View 2 Replies View Related

System Error 5 Has Occurred.

Nov 25, 2003

i am not able to connect to sql server.
when i run Net View \servername
i get "system error 5 has occurred. access denied" .
what does this mean? my (client) machine has win 2000 prof. installed and the server machine has win nt server on it

View 2 Replies View Related

Arithmetic Overflow Occurred.

Sep 10, 2001

When I try to run the query..it goes well..but says
Arithmetic overflow occurred.
at the end of the records..

What does that means..?

View 1 Replies View Related

An Unknown Error (-50) Occurred

Feb 11, 2008

An unknown error (-50) occurred.

So I can not recieve my email.

Running Entourage Student Ed.2004, Mac OS 10.5!

View 1 Replies View Related

Synchronization Exception Occurred

Jun 1, 2007

Hi!

I recently installed the Technical Refresh for SPS v2. Now I keep getting an error in the application log that says " Synchronization exception occurred" . This occurs every 30 seconds since the technical refresh install.

Has anybody been in this situation and actually resolved it?




Thnaks, Kumsi

View 1 Replies View Related

A Generic Error Occurred In Gdi+

Feb 8, 2006

I'm receiving "a generic error occurred in gdi+" processing error while
running a preview of my report inside visual studio. When this report
is opened by a client, their browser will just hang (Not Responding).

Other reports don't have error. The report will not render any chart although thousands of record will be need to output.

Hope anyone can help. Thanks!

View 5 Replies View Related

Validation Warnigns Occurred - Where Are They?

Oct 11, 2006

On of my Control Flow Items (which is a data flow task) has a little yellow warning icon on it, when I hover over it I get a 'Validation warnings occurred' pop-up. However in the Errors List for the Control Flow or Data Flow there are no errors warnings (). How do I find the valiation error - or force the package to re-validate?

View 7 Replies View Related

Is There A Way To Check When The Last Log Truncate Occurred?

Feb 21, 2008



Is there a way to find out when the last transaction log truncation occurred?

Thanks!

View 4 Replies View Related

Why Cannot Get The Maximum??

Jul 6, 2006

hi, im trying to get the last row of a column by using this code
 cmd.CommandText = "SELECT max(orderID) as orderID from orders where memberNo = '" & Session.Item("memberNum") & "'"but it return me 1 instead which is the smallest value in my orderID column n located in the first rowthen i try to use this code but they say got syntax errorcmd.CommandText = "SELECT max(orderID) as orderID from orders where memberNo = '" & Session.Item("memberNum") & "'" ' order by orderID asc " ' and orderID = '" & Session("ordersID") & "'"
can anyone tell me the right way to write the syntax??
thx in advance 

View 2 Replies View Related

Maximum RAM

Aug 7, 2002

Does anyone know the specific website that documents the maximum RAM SQL 7.0 Standard and Enterprise edition can handle within Windows 2000 Server and Windows 2000 Advanced server? All help appreciated!!

darius

View 2 Replies View Related

Error :Arithmetic Overflow Occurred

Feb 7, 2000

I have two tables which have dates in varchar fields on both. I have to
join them to get the data . I wrote the following syntax in where clause. In
one of the fields includes time and the other does not. But the thing is, I
got the Arithmetic overflow occurred error message after '01/01/2000'. Isn't
it strange?

convert(varchar(30),convert(datetime,R.request_dat e),101)=convert(varchar(30
),convert(datetime,B.request_date),101)

View 2 Replies View Related

An Internal Consistency Error Occurred..

Jul 13, 2007

Hi all,
i have copied out the database backup from development center to my local machine,it is having approx.8GB in size and when
i m trying to restote this database backup in SQL Server 2000 it is showing me error.
An internal consistency error occurred. Contact Technical Support for assistance.
RESTORE DATABASE is terminating abnormally.
Plz. anyone can help me..


mukul:confused:

View 2 Replies View Related

An Internal Consistency Error Occurred

Jan 24, 2008

I think I'm hosed...anyone ever seen this before?

Server: Msg 3270, Level 16, State 1, Line 1
An internal consistency error occurred. Contact Technical Support for assistance.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

View 8 Replies View Related

An Error Has Occurred While Establishing A Connect

Apr 14, 2008

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this
I use Microsoft Windows Vista Home Professional
I have already installed to my computer Microsoft SQL Server 2005 and SQL Serves Express. I used to successful to connect to the SQL Server but now I CAN NOT.

Not: I try to run SQL Server 2005 but I can not, even I logged on to my computer with an administrator rights. On the other hand I can start and stop the SQL Server easily.

As a result, how can I solve this problem?
Thanks in advance.
Bilgin Kiliç

Additional Details

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

View 1 Replies View Related

An Error Occurred Which The SQL Server Integration

Feb 7, 2008

Hi Team,

I am having a problem in importing excel data (.xls)into a database in SQL 2005. I am recieving this error. Please help me out.

TITLE: SQL Server Import and Export Wizard
------------------------------

An error occurred which the SQL Server Integration Services Wizard was not prepared to handle.

------------------------------
ADDITIONAL INFORMATION:

Exception has been thrown by the target of an invocation. (mscorlib)

------------------------------

The connection type "EXCEL" specified for connection manager "{3202D5F6-2BE9-48E6-A340-0AF11BD66EEB}" is not recognized as a valid connection manager type. This error is returned when an attempt is made to create a connection manager for an unknown connection type. Check the spelling in the connection type name.
({7CCAA790-6BB5-4778-805C-65E905CA6442})

------------------------------

The connection type "EXCEL" specified for connection manager "{3202D5F6-2BE9-48E6-A340-0AF11BD66EEB}" is not recognized as a valid connection manager type. This error is returned when an attempt is made to create a connection manager for an unknown connection type. Check the spelling in the connection type name.
({7CCAA790-6BB5-4778-805C-65E905CA6442})

------------------------------
BUTTONS:

OK
------------------------------

View 3 Replies View Related

An Error Has Occurred While Establishing A Connect

Mar 2, 2008

Hi,
I'm developing an ASP website with components developed under C# (DLL). The component is working ok when I temporarily used winforms to test it prior to compiling to DLL. but when I used that component to a ASP script, I got the error:

"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

It is weird because I'm not using SQLServer 2005. I'm using MSSQL 2000 only. If the winform version is working ok, how come the asp version is not? all the proper registration of component was followed correctly (even though it sucks. i used to developed a component in VB6 before and I never encountered so many authentication crap unlike in .Net2.0)

Can someone help me on this?

Thank you in advance.

Joseph

View 9 Replies View Related

An Error Has Occurred On The Computer Running IIS

May 16, 2006

Hello All,

I'm developing pocket PC application.. when I want to replicate my data from pocket pc to development pc.. I've got this error on my pocket pc.. "An error has occurred on the computer running IIS"

Any ideas? Any help?

I'm using SQl Server 2000, SQL Server CE 2.0, VS.Net 2003



Thanks

View 3 Replies View Related

A Drawing Error Occurred When Exporting To PDF

May 19, 2006

Hello,

I have a report that I need to export to PDF, when I do so and re-open the report, I get a message stating "A Drawing Error Occurred".

Plus when I have a textbox with a large amount of data, it always kicks to a different page, instead of print what it can fit on the previous page and the rest on the next page.

Any help on this would greatly be appreciated.

Thanks in advance.

View 5 Replies View Related

An Error Occurred While Established A Connection

Jun 29, 2007

Hello

I am getting this err msg when trying to logon to my website on the web - on my machine there is no prob,



An error occurred while established a connection to the server.
When connection to Sql.S 2005, this failure may be caused by the fact that
under the default settings sql.s doesn't allow remote connection.
(provider ql.S Network interface, error:26- Error Location Server/Interface Specified)



(the files path is like in the web host s)

now this msg is related to the ASPNETDB.MDF (dont use sql.s db but this file)



thanks

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved