Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 select query - error

Author  Topic 

ayu
Starting Member

43 Posts

Posted - 2008-07-23 : 08:20:36
i have select query:

select distinct r.custnmbr, s.inet1 as email_id, r.custclas
from sales00 s
join restore01 r
on r.custnmbr=s.master_id
where r.modifdt > '12/31/2002'
and s.master_type = 'cus'
and s.inet1 like '%@%'

but while executing it gets me error like:

An error occurred while executing batch. Error message is: Non-negative number required.
Parameter name: count

do anyone give me solution.. also i want custnmbr starts with alphabet(a-z)..so what condition i have to put in where clause to get that?

thanks a lot!!!.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-23 : 08:26:27
[code]SELECT DISTINCT r.CustNmbr,
s.Inet1 AS Email_ID,
r.CustClas
FROM Sales00 AS s
INNER JOIN Restore01 AS r ON r.CustNmbr = s.Master_ID
WHERE r.ModifDt >= '20030101'
AND s.Master_Type = 'cus'
AND s.Inet1 LIKE '%@%.%'
AND r.CustNmbr LIKE '[a-zA-Z]%'[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ayu
Starting Member

43 Posts

Posted - 2008-07-23 : 08:40:09
thanks Peso..

but i got results from A-G and then it disconnected and got the same error:
An error occurred while executing batch. Error message is: Non-negative number required.
Parameter name: count

do anyone know why its getting and what will be the solution.

as other all sql queries are running properly..

thanks.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-23 : 08:44:29
Maybe you should post FULL code you use?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-23 : 08:47:13
Also see
http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=101012



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ayu
Starting Member

43 Posts

Posted - 2008-07-23 : 08:52:58
the results i m getting from A-G custnmbrs are:

custnmbr email-id custclas
------------------------------
A.002 sweet6@yahoo.com standard
A.Brwon01 brwon@aol.com patient
...............................
.............................
Gelonde gelonde@cigma.net ind-patient


as i want till Z-custnmbr but i m getting error..
and that is the only simple select query..i have not edited anything..

SELECT DISTINCT r.CustNmbr,
s.Inet1 AS Email_ID,
r.CustClas
FROM Sales00 AS s
INNER JOIN Restore01 AS r ON r.CustNmbr = s.Master_ID
WHERE r.ModifDt >= '20030101'
AND s.Master_Type = 'cus'
AND s.Inet1 LIKE '%@%.%'
AND r.CustNmbr LIKE '[a-zA-Z]%'


thanks for ur help.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-23 : 09:03:07
Also see this topic
http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=92222


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ayu
Starting Member

43 Posts

Posted - 2008-07-23 : 09:19:30
yup!! Peso..thanks for ur help..

but before posting my query here i saw both the links in this forum..but i didn't get rid of this error that's why i posted new topic..

don't know why m getting an error like this as all several sql queries r running perfect..but stucking in middle while executing this only query..

anyways, thanks for ur help peso..but do u think any alternative what's the reason as query is simple joining two tables..
thanks.
Go to Top of Page
   

- Advertisement -