Showing posts with label select. Show all posts
Showing posts with label select. Show all posts

Thursday, March 29, 2012

error executing query

I have a database running on MSDE it was working fine. Recently when I try to select from the database I am getting the following error after a few records have been returned. All of the tables are giving this problem. Not sure what to do.
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData (CheckforData()).
[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.
Connection Broken
These are network problems - update your drivers for network card, check
cables and so on.
You can try also to run from command prompt "ping -t yourserver" and see if
there are lost packets.
Just in case do a db check from query analyzer - "DBCC checkdb"
Bojidar Alexandrov

error executing query

I have a database running on MSDE it was working fine. Recently when I try t
o select from the database I am getting the following error after a few reco
rds have been returned. All of the tables are giving this problem. Not sure
what to do.
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForD
ata (CheckforData()).
[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network err
or. Check your network documentation.
Connection Broken"Warren" <anonymous@.discussions.microsoft.com> wrote in message
news:E77B88A4-C231-4C30-B2D2-C4282A43A32F@.microsoft.com...
> I have a database running on MSDE it was working fine. Recently when I try
to select from the database I am getting the following error after a few
records have been returned. All of the tables are giving this problem. Not
sure what to do.
> [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData[/c
olor]
(CheckforData()).
> [Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Ch
eck
your network documentation.
> Connection Broken
>
It could be several things... first a question: were any changes made or
different software installed on the computer running MSDE?
If not, databases like MSDE and SQL Server can expose network issues such as
packet drops or interruptions. Also, rule out name resolution problems like
DNS or WINS.
Another angle, consider installing the latest version of MDAC on the client
computer and enabling both SQL Server utilities TCP/IP and Named Pipes.
Steve

error executing query

I have a database running on MSDE it was working fine. Recently when I try to select from the database I am getting the following error after a few records have been returned. All of the tables are giving this problem. Not sure what to do.
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData (CheckforData()).
[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.
Connection Broken
"Warren" <anonymous@.discussions.microsoft.com> wrote in message
news:E77B88A4-C231-4C30-B2D2-C4282A43A32F@.microsoft.com...
> I have a database running on MSDE it was working fine. Recently when I try
to select from the database I am getting the following error after a few
records have been returned. All of the tables are giving this problem. Not
sure what to do.
> [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData
(CheckforData()).
> [Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check
your network documentation.
> Connection Broken
>
It could be several things... first a question: were any changes made or
different software installed on the computer running MSDE?
If not, databases like MSDE and SQL Server can expose network issues such as
packet drops or interruptions. Also, rule out name resolution problems like
DNS or WINS.
Another angle, consider installing the latest version of MDAC on the client
computer and enabling both SQL Server utilities TCP/IP and Named Pipes.
Steve
sql

Monday, March 19, 2012

Error creating control

Hello everybody,
I my asp.net application, when I select a CrystalReportViewer control and put it on my form, it says "Error creating control" and hence I am unable to use it.
Any ideas ??
Thankslooks like ur .NET is corrupted. Try with another language (VB.NET). If it the same u gotta reinstall .NET.

Error Creating a New Publication

When Attempting to set up replication on my SQL server 2005 server, I right
click and select new publication and imediately get the following error
message:
SQL Server is unable to connect to server 'spi-svr6'. (New Publication Wizard)
For help, click:
http://go.microsoft.com/fwlink?ProdN...t&LinkId=20476
===================================
SQL Server replication requires the actual server name to make a connection
to the server. Connections through a server alias, IP address, or any other
alternate name are not supported. Specify the actual server name,
'SPI-SVR203'. (Replication.Utilities)
Program Location:
at
Microsoft.SqlServer.Management.UI.ReplicationSqlCo nnection.CheckServerAlias(ServerConnection conn)
at Microsoft.SqlServer.Management.UI.ReplicationSqlCo nnection.Open()
at
Microsoft.SqlServer.Management.UI.CreatePublicatio nWizard.PrepareToShow()
The help link provides nothing on this and I have been unable to locate any
info on other user sites. I am at a loss on what the communication problem
may be as the replication wizzard does not even begin.
Any help would be appreciated
"Lance" wrote:

> When Attempting to set up replication on my SQL server 2005 server, I right
> click and select new publication and imediately get the following error
> message:
> SQL Server is unable to connect to server 'spi-svr6'. (New Publication Wizard)
> --
> For help, click:
> http://go.microsoft.com/fwlink?ProdN...t&LinkId=20476
> ===================================
> SQL Server replication requires the actual server name to make a connection
> to the server. Connections through a server alias, IP address, or any other
> alternate name are not supported. Specify the actual server name,
> 'SPI-SVR203'. (Replication.Utilities)
> --
> Program Location:
> at
> Microsoft.SqlServer.Management.UI.ReplicationSqlCo nnection.CheckServerAlias(ServerConnection conn)
> at Microsoft.SqlServer.Management.UI.ReplicationSqlCo nnection.Open()
> at
> Microsoft.SqlServer.Management.UI.CreatePublicatio nWizard.PrepareToShow()
> The help link provides nothing on this and I have been unable to locate any
> info on other user sites. I am at a loss on what the communication problem
> may be as the replication wizzard does not even begin.
> Any help would be appreciated
|||If you look at management studio and check the name of the server at the top
of the tree
that is the name under which the server is registered...
Also do a sp_helpserver query to determine the name corresponding to id 0
the registered name should be the same as that for id 0 (which normally is the
name of the server where SQL is installed.
"Lance" wrote:

> When Attempting to set up replication on my SQL server 2005 server, I right
> click and select new publication and imediately get the following error
> message:
> SQL Server is unable to connect to server 'spi-svr6'. (New Publication Wizard)
> --
> For help, click:
> http://go.microsoft.com/fwlink?ProdN...t&LinkId=20476
> ===================================
> SQL Server replication requires the actual server name to make a connection
> to the server. Connections through a server alias, IP address, or any other
> alternate name are not supported. Specify the actual server name,
> 'SPI-SVR203'. (Replication.Utilities)
> --
> Program Location:
> at
> Microsoft.SqlServer.Management.UI.ReplicationSqlCo nnection.CheckServerAlias(ServerConnection conn)
> at Microsoft.SqlServer.Management.UI.ReplicationSqlCo nnection.Open()
> at
> Microsoft.SqlServer.Management.UI.CreatePublicatio nWizard.PrepareToShow()
> The help link provides nothing on this and I have been unable to locate any
> info on other user sites. I am at a loss on what the communication problem
> may be as the replication wizzard does not even begin.
> Any help would be appreciated
|||Thanks for great help gopal!
"Lance" wrote:

> When Attempting to set up replication on my SQL server 2005 server, I right
> click and select new publication and imediately get the following error
> message:
> SQL Server is unable to connect to server 'spi-svr6'. (New Publication Wizard)
> --
> For help, click:
> http://go.microsoft.com/fwlink?ProdN...t&LinkId=20476
> ===================================
> SQL Server replication requires the actual server name to make a connection
> to the server. Connections through a server alias, IP address, or any other
> alternate name are not supported. Specify the actual server name,
> 'SPI-SVR203'. (Replication.Utilities)
> --
> Program Location:
> at
> Microsoft.SqlServer.Management.UI.ReplicationSqlCo nnection.CheckServerAlias(ServerConnection conn)
> at Microsoft.SqlServer.Management.UI.ReplicationSqlCo nnection.Open()
> at
> Microsoft.SqlServer.Management.UI.CreatePublicatio nWizard.PrepareToShow()
> The help link provides nothing on this and I have been unable to locate any
> info on other user sites. I am at a loss on what the communication problem
> may be as the replication wizzard does not even begin.
> Any help would be appreciated
|||gopal,
You are right on target. The helpserver SP returns the old server name.
Will the drop/add sp's fix this?
"gopal" wrote:
[vbcol=seagreen]
> If you look at management studio and check the name of the server at the top
> of the tree
> that is the name under which the server is registered...
> Also do a sp_helpserver query to determine the name corresponding to id 0
> the registered name should be the same as that for id 0 (which normally is the
> name of the server where SQL is installed.
> "Lance" wrote:
|||You can use the @.@.SERVERNAME global variable or the
SERVERPROPERTY('ServerName') function in SQL Server to find the network name
of the computer running SQL Server. The ServerName property of the
SERVERPROPERTY function automatically reports the change in the network name
of the computer when you restart the computer and the SQL Server service.
The @.@.SERVERNAME global variable retains the original SQL Server computer
name until the SQL Server name is manually reset.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Sunday, March 11, 2012

error converting datatypes

Hello,

Firstly, i need to work out why I cannot change my datatypes(please see query)

Code Snippet

SELECT * FROM (

SELECT top 10

ref,

RecordDate,

TransactionID,

StatusChangedTimeStamp,

TransactionStatus,

PartyTransactionStatus,

BadDeliveryReason,

TradingDaysRef

FROM (

SELECT 1 seq,

'ref' ref,

'RecordDate' RecordDate,

'TransactionID' TransactionID,

'TransactionStatus' TransactionStatus,

'StatusChangedTimeStamp' StatusChangedTimeStamp,

'PartyTransactionStatus' PartyTransactionStatus,

'BadDeliveryReason' BadDeliveryReason,

'TradingDaysRef' TradingDaysRef

UNION ALL

SELECT 2 seq,

cast(ref as bigint),

RecordDate,

TransactionID,

StatusChangedTimeStamp,

TransactionStatus,

PartyTransactionStatus,

BadDeliveryReason,

TradingDaysRef

FROM dbo.ParticipantTradeStatusChange

) x

order by seq, RecordDate

) y

The error returned is:

Server: Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to bigint.

The reason for me doing this, is exporting both column names & data to a xls file.

Secondly, once i get the query to complete...I kindly ask, how would i make this query a little swifter in which, i mean, select the top 100 from the table then SELECT the columns...when i do

SELECT top 10 * FROM (

SELECT *

It falls over and dies

Help much appreciated

thanks,

i

The data -- literals -- that you have above your unions are not implicitly compatible with what is below the union. Look at this example:

Code Snippet

select 'Header'
union all
select 2

/*
Server: Msg 245, Level 16, State 1, Line 1
Syntax error converting the varchar value 'Header' to a column of data type int.
*/

I am basically getting the same error. You may need to explicitly declare the datatype of the lower part of the union to have them go as varchar -- maybe like:


Code Snippet

select 'Header' as Data
union all
select cast (2 as varchar)

/*
Data
Header
2
*/

|||

i've done a dirty workaround..

simply used cast(columnname as varchar(4000))

did the trick and i have my bcp file with headings Smile

all todo now is make it run faster...

Error converting data type varchar to float.

following is my stored procedure... it's giving error at second "open cur"

Please help !!!!!!!!!!!!!!!

declare cur cursor for select id from smita.dbo.users where
userid not in (select userid from fpeligibility6...monarch1) and --change table
usercompany = @.companyid and
termdate > getdate() and
datediff(m,updated,getdate()) > 2

open cur

fetch next from cur into @.uid

while @.@.fetch_status = 0
begin
update smita.dbo.users set termdate = getdate(), updated = getdate() where id = @.uid
set @.i = @.i + 1
fetch next from cur into @.uid
end

close cur
deallocate cur

--new users
declare cur cursor for select rtrim(f.employeessn),rtrim(f.userid), rtrim(f.password),
--(substring(f.firstname,1,1) + rtrim(substring(f.lastname,1,15))),'abc123',
rtrim(f.userlevel),
rtrim(f.lastname),rtrim(f.firstname),
rtrim(f.mi),rtrim(f.ssn),
rtrim(f.relation),f.dob,
rtrim(f.sex),rtrim(f.address1),
rtrim(f.address2),rtrim(f.city),
rtrim(f.state),rtrim(f.zipcode),rtrim(f.emailaddre ss), f.activedate, f.termdate,
rtrim(f.usertype),
rtrim(f.usercompany), rtrim(f.usergroup),

f.apptmtgrp,
f.apptmtgrp2,rtrim(f.homephone),
rtrim(f.workphone)
from fpeligibility6...monarch1 f --change table to reflect eligibility file
left outer join smita.dbo.users u on f.userid = u.userid
where u.userid is null

open cur
fetch next from cur into @.employeessn, @.userid, @.password, @.userlevel, @.lastname, @.firstname, @.middleinitial, @.ssn, @.relation, @.dob, @.sex, @.address1, @.address2, @.city, @.state, @.zipcode, @.emailaddress, @.active, @.termdate, @.usertype, @.usercompany, @.usergroup, @.apptmtgrp, @.apptmtgrp2, @.homephone, @.workphone

while @.@.fetch_status = 0
begin
insert into smita.dbo.users (employeessn, userid, userid1, password, userlevel, oldid, lastname, firstname, middleinitial, ssn, relation, dob, sex, address1, address2, city, state, zipcode, country, emailaddress, activedate, termdate, usertype, usercompany, usergroup, apptmtgrp, apptmtgrp2, homephone, workphone, updated) values (@.employeessn, @.userid, 0, @.password, @.userlevel, 0, @.lastname, @.firstname, @.middleinitial, @.ssn, @.relation, @.dob, @.sex, @.address1, @.address2, @.city, @.state, @.zipcode, 'USA', @.emailaddress, @.active, @.termdate, @.usertype, @.usercompany, @.usergroup, @.apptmtgrp, @.apptmtgrp2, @.homephone, @.workphone, getdate())
fetch next from cur into @.employeessn, @.userid, @.password, @.userlevel, @.lastname, @.firstname, @.middleinitial, @.ssn, @.relation, @.dob, @.sex, @.address1, @.address2, @.city, @.state, @.zipcode, @.emailaddress, @.active, @.termdate, @.usertype, @.usercompany, @.usergroup, @.apptmtgrp, @.apptmtgrp2, @.homephone, @.workphone
end

close cur
deallocate cur

--updated users termdate
update smita.dbo.users
set termdate = e.termdate, updated = getdate()
from fpeligibility6...monarch1 e --change table name
join smita.dbo.users u on u.userid is not null and u.userid = e.useridSmells like Oracle code...
Drop the cursors, learn how to write SQL, and join the big boys.

update smita.dbo.users
set termdate = getedate(),
updated = getdate
from smita.dbo.users
left outer join fpeligibility6...monarch1
on smita.dbo.users.userid = fpeligibility6...monarch1.userid
where usercompany = @.companyid
and termdate > getdate()
and datediff(m,updated,getdate()) > 2
and fpeligibility6...monarch1.userid is null

--new users
insert into smita.dbo.users
(employeessn,
userid,
userid1,
password,
userlevel,
oldid,
lastname,
firstname,
middleinitial,
ssn,
relation,
dob,
sex,
address1,
address2,
city,
state,
zipcode,
country,
emailaddress,
activedate,
termdate,
usertype,
usercompany,
usergroup,
apptmtgrp,
apptmtgrp2,
homephone,
workphone,
updated)
select rtrim(f.employeessn),
rtrim(f.userid),
0,
rtrim(f.password),
--(substring(f.firstname,1,1) + rtrim(substring(f.lastname,1,15))),'abc123',
rtrim(f.userlevel),
0,
rtrim(f.lastname),
rtrim(f.firstname),
rtrim(f.mi),
rtrim(f.ssn),
rtrim(f.relation),
f.dob,
rtrim(f.sex),
rtrim(f.address1),
rtrim(f.address2),
rtrim(f.city),
rtrim(f.state),
rtrim(f.zipcode),
'USA',
rtrim(f.emailaddress),
f.activedate,
f.termdate,
rtrim(f.usertype),
rtrim(f.usercompany),
rtrim(f.usergroup),
f.apptmtgrp,
f.apptmtgrp2,
rtrim(f.homephone),
rtrim(f.workphone),
getdate()
from fpeligibility6...monarch1 f --change table to reflect eligibility file
left outer join smita.dbo.users u on f.userid = u.userid
where u.userid is null

Run the above code (instead of your cursors), and check the line that gives you the conversion error.
And what the heck was "set @.i = @.i + 1" for, anyway?|||One thing I'll pick up on is how you have written your code... All lower case with no indentations etc (ok, I know the forum will remove a lot of indents; depending on your method, but hey) - this makes it much much harder to read and follow through.
Not how blindman has written his code as a clear list with indents (no capitalized keywords though :shocked:!)

Much easier to follow through and better for debugging. Remember this next time you write any SQL ;)|||Thanks man ... I mean blindman.....

I will remember that georgev....

Sunday, February 26, 2012

Error connecting new data source to SQL Server Express

In ODBC Data Source Administrator, I add the SQL Server driver, complete a name and select my local SQL Server instance, select Windows NT authentication (the client configuration is set to TCP/IP, dynamically determine port) and on clicking Next, the following errors occur:

Connection failed:
SQLState: '01000'
SQL Server error: 2
[Microsoft][ODBC SQL Server Driver][Shared Memory][ConnectionOpen (Connect()).
Connection failed:
SQLState: '08001'
SQL Server error: 17
[Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or access denied.

I note that in the Help it says: "The SQL Server system administrator must have associated your Microsoft Windows login with a SQL Server login ID".

Is this the problem? If so, where do I make this association?

Thanking you in anticipation.

In a default installation of SQL Express, every user on a computer can at least connect to the server. The fact that you're connection is failing suggests that something else is wrong. Based on the error, the most likely cause is that you've mis-typed the server name. SQL Express installs to a named instance so you need to provide both the machine name and instance name in your connection, be default, the instance name is SQLEXPRESS, so your server name would be <machinename>\SQLEXPRES. For local connection you can replace <machinename> with "(local)" or "." Note that it's a back slash, people commonly use the forward slash which will cause an error.

If that doesn't help, verify which SQL driver you are using, there are two of them. It looks like you're using the Native Client, which is good, but if you're using the old MDAC driver (just says "SQL Server" in the list) then you'll need to enable the TCP protocol for the Server using the SQL Configuration Manager. MDAC ODBC connection go through TCP, even for local connections.

Mike

|||

Hi,

I would suggest to refer http://support.microsoft.com/kb/322336 & http://support.microsoft.com/kb/328306/en-us

Hemantgiri S. Goswami

Error connecting new data source to SQL Server Express

In ODBC Data Source Administrator, I add the SQL Server driver, complete a name and select my local SQL Server instance, select Windows NT authentication (the client configuration is set to TCP/IP, dynamically determine port) and on clicking Next, the following errors occur:

Connection failed:
SQLState: '01000'
SQL Server error: 2
[Microsoft][ODBC SQL Server Driver][Shared Memory][ConnectionOpen (Connect()).
Connection failed:
SQLState: '08001'
SQL Server error: 17
[Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or access denied.

I note that in the Help it says: "The SQL Server system administrator must have associated your Microsoft Windows login with a SQL Server login ID".

Is this the problem? If so, where do I make this association?

Thanking you in anticipation.

In a default installation of SQL Express, every user on a computer can at least connect to the server. The fact that you're connection is failing suggests that something else is wrong. Based on the error, the most likely cause is that you've mis-typed the server name. SQL Express installs to a named instance so you need to provide both the machine name and instance name in your connection, be default, the instance name is SQLEXPRESS, so your server name would be <machinename>\SQLEXPRES. For local connection you can replace <machinename> with "(local)" or "." Note that it's a back slash, people commonly use the forward slash which will cause an error.

If that doesn't help, verify which SQL driver you are using, there are two of them. It looks like you're using the Native Client, which is good, but if you're using the old MDAC driver (just says "SQL Server" in the list) then you'll need to enable the TCP protocol for the Server using the SQL Configuration Manager. MDAC ODBC connection go through TCP, even for local connections.

Mike

|||

Hi,

I would suggest to refer http://support.microsoft.com/kb/322336 & http://support.microsoft.com/kb/328306/en-us

Hemantgiri S. Goswami