Showing posts with label application. Show all posts
Showing posts with label application. Show all posts

Thursday, March 29, 2012

Error Executing, SSIS Packages Coppied from another server

Hello All,

I am working on an application used to move packages (SSIS Packages) from one server to another.The packages are saved under MSDB folder.

Case: When the application is running on my system, i try to copy packages created from another server to my Server.I am using package protection level as "Server Storage". When i try to execute the coppied package from my system, it is giving me error.
An oledb error has occured, Error Code 0x80040E4D, An Oledb record is available, Source : Microsoft OLedb Provider for Sql Server", Description : "Login failed for sa".

Case : When the Package Coppier application is running on my system, i try to copy packages created on my server to my another Server.I use the same package protection level as "Server Storage". When i try to execute the copied package on destination server it is working fine without errors.

Please guide me on this issue, as soon as possible

Thanks And Regards
Subin

Make sure all the permissions are properly set on your server.

DId you read this (http://www.microsoft.com/technet/prodtechnol/sql/2005/mgngssis.mspx)

ServerStorage. No encryption is added to the package. Instead the package’s contents are secured based on the database’s object access security. If the ServerStorage value is used, the package must be saved to SQL Server in the sysdtspackages90 table in the msdb database. It cannot be saved to the file system.

The SSIS package security model is also extensible. There is a Sensitive attribute in the XML schema of an SSIS package that controls access to the package’s properties. For example, if the Sensitive attribute is set to 1, when the user opens the package all sensitive data will be removed. Developers can incorporate this Sensitive attribute to get the same type of protection for their SSIS custom components.

If you are using the ServerStorage ProtectionLevel property, the method of controlling access to the packages saved in the database is by using SQL Server Database roles. By default, SQL Server 2005 provides the following roles for SSIS package management . You can find these by opening SQL Server Management Studio, then expanding the msdb database, Roles, Database Roles node:

?

db_dtsadmin. SSIS package administrator rights.

?

db_dtsltduser. Rights to execute only the SSIS packages the user has been given permission for.

?

db_dtsoperator. Operation rights to SSIS packages including the ability to run as well as backup and restore packages.

You can also create your own custom database roles for SSIS Package management. Add the appropriate users to those roles and then assign those roles to your own SSIS packages.

You can enable package roles using the SQL Server Management Studio by right-clicking a saved package and then selecting the Package Roles option on the shortcut menu as is shown in Figure 11

BTW, is there any reason for not using SSMS to import/export the packages (http://www.microsoft.com/technet/prodtechnol/sql/2005/mgngssis.mspx)

Thursday, March 22, 2012

error during .NET Remoting

Hi

When I run the reports in my .NET application, I get an error message when I attempt to use .NET remoting while processing a report :

"The type CrystalDecisions.CrystalReports.Engine.FormatEngine in Assembly CrystalDecisions.CrystalReports.Engine, Version=11.2.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 is not marked as serializable."

I checked the net for solution, and the work around for this error message, use Report Web Services, or the Crystal Enterprise Report Application Server (CE RAS) or Crystal Enterprise (CE) .NET SDK in your application.

But this will be a major change in the application.

Has anybody else got the same error and found a simpler solution ?

Thanking in advanceSee if you find answer here
http://support.businessobjects.com/

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.

Sunday, March 11, 2012

Error converting data type varchar to numeric

Hi,

Thank you in advance for your comments/suggestions. I am trying to create a View of a Table. The table is created by another application so I am unable to recreate it they way I want, also the data that is in the columns that I want to CAST are "numbers" not letters and will only be numbers. In the view I need certain columns to be CAST as numeric from varchar.

Here is the syntax that I am currently using:

Code Snippet

SELECT CAST(szF1 AS datetime) AS [Login Date/Time], szF2 AS [User Name], CAST(szF3 AS numeric) AS [Documents Indexed], CAST(szF4 AS datetime) AS [Logout Date/Time], CAST(szF5 AS numeric) AS [Documents Sent to QC], CAST(szF6 AS numeric) AS [Documents Reconciled], szF7 AS [Reject Reason], CAST(szF8 AS datetime) AS [Report Date]

FROM dbo.F_Report_Data AS a

WHERE (szF3 <> 'Blank')

When I open the view I get the error message about converting varchar to numeric.

Thanks,

Erik

Try running this query:

Code Snippet

SELECT CAST(szF1 AS datetime) AS [Login Date/Time],
szF2 AS [User Name],
-- CAST(szF3 AS numeric) AS [Documents Indexed],
szF3,
CAST(szF4 AS datetime) AS [Logout Date/Time],
-- CAST(szF5 AS numeric) AS [Documents Sent to QC],
-- CAST(szF6 AS numeric) AS [Documents Reconciled],
szF5,
szF6,
szF7 AS [Reject Reason],
CAST(szF8 AS datetime) AS [Report Date]
FROM dbo.F_Report_Data AS a
where isNumeric (szF3 + 'D0') = 0
or isNumeric (szF5 + 'D0') = 0
or isNumeric (szF6 + 'D0') = 0

And post any results that get returned.|||

I tried your suggestion and I got an error: "Error in list of function arguments: '=' not recognized. Unable to parse query text.

|||

It's likely because you have data in the szF5 or szF6 columns that can't be converted to numeric. For example, if I had the value aaa in szF5, I would get that error. More common is if I have a zero length string in the column, that can't be converted to numeric and I would get the error. A null would be fine but a zero length string would cause the error.

-Sue

|||

I would suggest (1) give the schema of the table and (2) give 5 sample rows of data from the table by doing a

select top 5 * from F_Report_Data

|||

The 3 columns that I want to cast as numeric have only numbers in them.

1/24/2007 9:58:03 AM admin 207 1/24/2007 2:08:55 PM 0 0 1/24/2007 12:00:00 AM
1/24/2007 9:59:03 AM admin 0 1/24/2007 4:09:25 PM 1 0 Unable to read case number 1/24/2007 12:00:00 AM
1/24/2007 9:56:03 AM admin 0 1/24/2007 4:26:33 PM 0 3 1/24/2007 12:00:00 AM
1/25/2007 1:55:19 PM admin 0 1/25/2007 3:32:51 PM 0 0 1/25/2007 12:00:00 AM
1/25/2007 1:55:19 PM test 0 1/25/2007 4:11:09 PM 1 0 Unable to read case number 1/25/2007 12:00:00 AM

The items in bold are thecolumns that I am trying to covnert/cast as numeric.

|||

The 3 columns that I want to cast as numeric have only numbers in them.

Code Snippet

1/24/2007 9:58:03 AM admin 207 1/24/2007 2:08:55 PM 0 0 1/24/2007 12:00:00 AM
1/24/2007 9:59:03 AM admin 0 1/24/2007 4:09:25 PM 1 0 Unable to read case number 1/24/2007 12:00:00 AM
1/24/2007 9:56:03 AM admin 0 1/24/2007 4:26:33 PM 0 3 1/24/2007 12:00:00 AM
1/25/2007 1:55:19 PM admin 0 1/25/2007 3:32:51 PM 0 0 1/25/2007 12:00:00 AM
1/25/2007 1:55:19 PM test 0 1/25/2007 4:11:09 PM 1 0 Unable to read case number 1/25/2007 12:00:00 AM

The items in bold are thecolumns that I am trying to covnert/cast as numeric.

Could you clarify by what you mean "Schema", it has been a while since my DB class and I am not a DBA. Every column is varchar(8000),null except for the PK which is (int, not null).

I awm giong to attempt to see if I can get the necessary results w/o convert/cast because there is supposed to be implicit conversion of varchar to numeric.

|||

Actually, you have answered the schema question -- all columns are varchar(8000) except for the PK which is integer -- a "wow" table. That should be enough for now. Try running this query and see if any results are returned:

Code Snippet

select left(szF1, 25) as szF1,
left(szF2, 25) as szF2,
left(szF3, 25) as szF3,
left(szF4, 25) as szF4,
left(szF5, 25) as szF5,
left(szF6, 25) as szF6,
left(szF7, 25) as szF7,
left(szF8, 25) as szF8
from dbo.F_Report_data
where isDate(szF1) = 0
or isNumeric (szF3 + 'D0') = 0
or isDate(szF4) = 0
or isNumeric (szF5 + 'D0') = 0
or isNumeric (szF6 + 'D0') = 0
or isDate(szF8) = 0

|||

Yes it returned a result, it's good that it returned a result but does that mean that we can/cannot convert/cast a varchar as a numeric? Thanks for your help!!

|||

Please post a sampling of the results that you received. It means that you will might either need to change the table or modify the way you display the data so that it is properly "clensed" -- you have dirty data.

|||

Here are the results:

Code Snippet

01/24/2007 09:58:03 AM admin 207 01/24/2007 02:08:55 PM 0 0 20070124
01/24/2007 09:59:03 AM admin 0 01/24/2007 04:09:25 PM 1 0 Unable to read case numbe 20070124
01/24/2007 09:56:03 AM admin 0 01/24/2007 04:26:33 PM 0 3 20070124
01/25/2007 01:55:19 PM admin 3 01/25/2007 03:32:51 PM 0 0 20070125

01/25/2007 01:55:19 PM test 0 01/25/2007 04:11:09 PM 1 0 Unable to read case numbe 20070125

| szf1| |szF2| szF3 |--szF4-| szF5 sz F6 |-szF7-| |szF8|

I just noticed that the query trimmed szF7 (Where it says "Unable to read case numbe"), I will need that field a little larger for the text. I never would have thought that there would be so much trouble to convert/cast a varchar to a numeric in a view.|||That did not display the same way it did on my screen when I was typing it. I hope it isn't too confusing.|||

Can somebody point Erik to an article about cleaning up data? My tests weren't strong enough and I really am not interested in wasting Erik's time. I suspect that blanks in his data caused the isNumeric tests to fail.

Erik:

You can try this query; it will exhibit which test is failing:

Code Snippet

select isDate(rtrim(szF1)) as szF1isDate,
isNumeric (rtrim(szF3) + 'D0') as szF3IsNumeric,
isDate(rtrim(szF4)) as szF4IsDate,
isNumeric (rtrim(szF5) + 'D0') as szF5IsNumeric,
isNumeric (rtrim(szF6) + 'D0') as szF6IsNumeric,
isDate(rtrim(szF8)) as szF8isDate,
left(szF1, 30) as szF1,
left(szF2, 30) as szF2,
left(szF3, 30) as szF3,
left(szF4, 30) as szF4,
left(szF5, 30) as szF5,
left(szF6, 30) as szF6,
left(szF7, 30) as szF7,
left(szF8, 30) as szF8
from dbo.F_Report_data
where isDate(rtrim(szF1)) = 0
or isNumeric (rtrim(szF3) + 'D0') = 0
or isDate(rtrim(szF4)) = 0
or isNumeric (rtrim(szF5) + 'D0') = 0
or isNumeric (rtrim(szF6) + 'D0') = 0
or isDate(rtrim(szF8)) = 0

I feel like I need a fresh set of eyes on this at this point. Help?

|||

Here are the results of the query. I don't really know what they are saying though, could you give me pseudo code explanation of the query?

0,1,0,1,1,0,,Blank,0,,0,0,,
1,1,1,0,0,1,01/25/2007 01:55:19 PM,admin,19,01/25/2007 04:11:43 PM,,,,20070125
1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 09:58:22 AM,1,0,Invalid case number,20070518
1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 10:01:14 AM,0,1,,20070518

|||

Erik:

To me the problem here is that the columns are not sufficiently typed; this is a design problem that should be fixed. If a column is intended to be used as a number it should be typed as numeric. Similarly, if a column is going to be used as a date it should be typed as a datetime column, not as a varchar. Here is the basic response to the records returned from the query:

0,1,0,1,1,0,,Blank,0,,0,0,,
this record failed for 3 reasons:
(1) The szF1 field is not a valid date (it is an empty string)
(2) The szF4 field is not a valid date (it is an empty string)
(3) the szF8 field is not a valid date (it is an empty string)

1,1,1,0,0,1,01/25/2007 01:55:19 PM,admin,19,01/25/2007 04:11:43 PM,,,,20070125
this record faild for two reasons:
(1) The szF5 field is not numeric (it is an empty string)
(2) the szF6 field is not numeric (it is an empty string)

]

1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 09:58:22 AM,1,0,Invalid case number,20070518
this record failed because:
(1) The szF3 field is not numeric (it is an empty string)

1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 10:01:14 AM,0,1,,20070518
this record failed because:
(1) The szF3 field is not numeric (it is an empty string)

Now, you might be able to use the NULLIF function to get around these problems since all of these are manifest when the column is an EMPTY string. If you are wanting to test for NUMERIC columns you might also want to give a look to this article about problems with the "isNumeric" built-in function:

http://classicasp.aspfaq.com/general/what-is-wrong-with-isnumeric.html

Error converting data type varchar to numeric

Hi,

Thank you in advance for your comments/suggestions. I am trying to create a View of a Table. The table is created by another application so I am unable to recreate it they way I want, also the data that is in the columns that I want to CAST are "numbers" not letters and will only be numbers. In the view I need certain columns to be CAST as numeric from varchar.

Here is the syntax that I am currently using:

Code Snippet

SELECT CAST(szF1 AS datetime) AS [Login Date/Time], szF2 AS [User Name], CAST(szF3 AS numeric) AS [Documents Indexed], CAST(szF4 AS datetime) AS [Logout Date/Time], CAST(szF5 AS numeric) AS [Documents Sent to QC], CAST(szF6 AS numeric) AS [Documents Reconciled], szF7 AS [Reject Reason], CAST(szF8 AS datetime) AS [Report Date]

FROM dbo.F_Report_Data AS a

WHERE (szF3 <> 'Blank')

When I open the view I get the error message about converting varchar to numeric.

Thanks,

Erik

Try running this query:

Code Snippet

SELECT CAST(szF1 AS datetime) AS [Login Date/Time],
szF2 AS [User Name],
-- CAST(szF3 AS numeric) AS [Documents Indexed],
szF3,
CAST(szF4 AS datetime) AS [Logout Date/Time],
-- CAST(szF5 AS numeric) AS [Documents Sent to QC],
-- CAST(szF6 AS numeric) AS [Documents Reconciled],
szF5,
szF6,
szF7 AS [Reject Reason],
CAST(szF8 AS datetime) AS [Report Date]
FROM dbo.F_Report_Data AS a
where isNumeric (szF3 + 'D0') = 0
or isNumeric (szF5 + 'D0') = 0
or isNumeric (szF6 + 'D0') = 0

And post any results that get returned.|||

I tried your suggestion and I got an error: "Error in list of function arguments: '=' not recognized. Unable to parse query text.

|||

It's likely because you have data in the szF5 or szF6 columns that can't be converted to numeric. For example, if I had the value aaa in szF5, I would get that error. More common is if I have a zero length string in the column, that can't be converted to numeric and I would get the error. A null would be fine but a zero length string would cause the error.

-Sue

|||

I would suggest (1) give the schema of the table and (2) give 5 sample rows of data from the table by doing a

select top 5 * from F_Report_Data

|||

The 3 columns that I want to cast as numeric have only numbers in them.

1/24/2007 9:58:03 AM admin 207 1/24/2007 2:08:55 PM 0 0 1/24/2007 12:00:00 AM
1/24/2007 9:59:03 AM admin 0 1/24/2007 4:09:25 PM 1 0 Unable to read case number 1/24/2007 12:00:00 AM
1/24/2007 9:56:03 AM admin 0 1/24/2007 4:26:33 PM 0 3 1/24/2007 12:00:00 AM
1/25/2007 1:55:19 PM admin 0 1/25/2007 3:32:51 PM 0 0 1/25/2007 12:00:00 AM
1/25/2007 1:55:19 PM test 0 1/25/2007 4:11:09 PM 1 0 Unable to read case number 1/25/2007 12:00:00 AM

The items in bold are thecolumns that I am trying to covnert/cast as numeric.

|||

The 3 columns that I want to cast as numeric have only numbers in them.

Code Snippet

1/24/2007 9:58:03 AM admin 207 1/24/2007 2:08:55 PM 0 0 1/24/2007 12:00:00 AM
1/24/2007 9:59:03 AM admin 0 1/24/2007 4:09:25 PM 1 0 Unable to read case number 1/24/2007 12:00:00 AM
1/24/2007 9:56:03 AM admin 0 1/24/2007 4:26:33 PM 0 3 1/24/2007 12:00:00 AM
1/25/2007 1:55:19 PM admin 0 1/25/2007 3:32:51 PM 0 0 1/25/2007 12:00:00 AM
1/25/2007 1:55:19 PM test 0 1/25/2007 4:11:09 PM 1 0 Unable to read case number 1/25/2007 12:00:00 AM

The items in bold are thecolumns that I am trying to covnert/cast as numeric.

Could you clarify by what you mean "Schema", it has been a while since my DB class and I am not a DBA. Every column is varchar(8000),null except for the PK which is (int, not null).

I awm giong to attempt to see if I can get the necessary results w/o convert/cast because there is supposed to be implicit conversion of varchar to numeric.

|||

Actually, you have answered the schema question -- all columns are varchar(8000) except for the PK which is integer -- a "wow" table. That should be enough for now. Try running this query and see if any results are returned:

Code Snippet

select left(szF1, 25) as szF1,
left(szF2, 25) as szF2,
left(szF3, 25) as szF3,
left(szF4, 25) as szF4,
left(szF5, 25) as szF5,
left(szF6, 25) as szF6,
left(szF7, 25) as szF7,
left(szF8, 25) as szF8
from dbo.F_Report_data
where isDate(szF1) = 0
or isNumeric (szF3 + 'D0') = 0
or isDate(szF4) = 0
or isNumeric (szF5 + 'D0') = 0
or isNumeric (szF6 + 'D0') = 0
or isDate(szF8) = 0

|||

Yes it returned a result, it's good that it returned a result but does that mean that we can/cannot convert/cast a varchar as a numeric? Thanks for your help!!

|||

Please post a sampling of the results that you received. It means that you will might either need to change the table or modify the way you display the data so that it is properly "clensed" -- you have dirty data.

|||

Here are the results:

Code Snippet

01/24/2007 09:58:03 AM admin 207 01/24/2007 02:08:55 PM 0 0 20070124
01/24/2007 09:59:03 AM admin 0 01/24/2007 04:09:25 PM 1 0 Unable to read case numbe 20070124
01/24/2007 09:56:03 AM admin 0 01/24/2007 04:26:33 PM 0 3 20070124
01/25/2007 01:55:19 PM admin 3 01/25/2007 03:32:51 PM 0 0 20070125

01/25/2007 01:55:19 PM test 0 01/25/2007 04:11:09 PM 1 0 Unable to read case numbe 20070125

| szf1| |szF2| szF3 |--szF4-| szF5 sz F6 |-szF7-| |szF8|

I just noticed that the query trimmed szF7 (Where it says "Unable to read case numbe"), I will need that field a little larger for the text. I never would have thought that there would be so much trouble to convert/cast a varchar to a numeric in a view.|||That did not display the same way it did on my screen when I was typing it. I hope it isn't too confusing.|||

Can somebody point Erik to an article about cleaning up data? My tests weren't strong enough and I really am not interested in wasting Erik's time. I suspect that blanks in his data caused the isNumeric tests to fail.

Erik:

You can try this query; it will exhibit which test is failing:

Code Snippet

select isDate(rtrim(szF1)) as szF1isDate,
isNumeric (rtrim(szF3) + 'D0') as szF3IsNumeric,
isDate(rtrim(szF4)) as szF4IsDate,
isNumeric (rtrim(szF5) + 'D0') as szF5IsNumeric,
isNumeric (rtrim(szF6) + 'D0') as szF6IsNumeric,
isDate(rtrim(szF8)) as szF8isDate,
left(szF1, 30) as szF1,
left(szF2, 30) as szF2,
left(szF3, 30) as szF3,
left(szF4, 30) as szF4,
left(szF5, 30) as szF5,
left(szF6, 30) as szF6,
left(szF7, 30) as szF7,
left(szF8, 30) as szF8
from dbo.F_Report_data
where isDate(rtrim(szF1)) = 0
or isNumeric (rtrim(szF3) + 'D0') = 0
or isDate(rtrim(szF4)) = 0
or isNumeric (rtrim(szF5) + 'D0') = 0
or isNumeric (rtrim(szF6) + 'D0') = 0
or isDate(rtrim(szF8)) = 0

I feel like I need a fresh set of eyes on this at this point. Help?

|||

Here are the results of the query. I don't really know what they are saying though, could you give me pseudo code explanation of the query?

0,1,0,1,1,0,,Blank,0,,0,0,,
1,1,1,0,0,1,01/25/2007 01:55:19 PM,admin,19,01/25/2007 04:11:43 PM,,,,20070125
1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 09:58:22 AM,1,0,Invalid case number,20070518
1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 10:01:14 AM,0,1,,20070518

|||

Erik:

To me the problem here is that the columns are not sufficiently typed; this is a design problem that should be fixed. If a column is intended to be used as a number it should be typed as numeric. Similarly, if a column is going to be used as a date it should be typed as a datetime column, not as a varchar. Here is the basic response to the records returned from the query:

0,1,0,1,1,0,,Blank,0,,0,0,,
this record failed for 3 reasons:
(1) The szF1 field is not a valid date (it is an empty string)
(2) The szF4 field is not a valid date (it is an empty string)
(3) the szF8 field is not a valid date (it is an empty string)

1,1,1,0,0,1,01/25/2007 01:55:19 PM,admin,19,01/25/2007 04:11:43 PM,,,,20070125
this record faild for two reasons:
(1) The szF5 field is not numeric (it is an empty string)
(2) the szF6 field is not numeric (it is an empty string)

]

1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 09:58:22 AM,1,0,Invalid case number,20070518
this record failed because:
(1) The szF3 field is not numeric (it is an empty string)

1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 10:01:14 AM,0,1,,20070518
this record failed because:
(1) The szF3 field is not numeric (it is an empty string)

Now, you might be able to use the NULLIF function to get around these problems since all of these are manifest when the column is an EMPTY string. If you are wanting to test for NUMERIC columns you might also want to give a look to this article about problems with the "isNumeric" built-in function:

http://classicasp.aspfaq.com/general/what-is-wrong-with-isnumeric.html

Error converting data type varchar to numeric

Hi,

Thank you in advance for your comments/suggestions. I am trying to create a View of a Table. The table is created by another application so I am unable to recreate it they way I want, also the data that is in the columns that I want to CAST are "numbers" not letters and will only be numbers. In the view I need certain columns to be CAST as numeric from varchar.

Here is the syntax that I am currently using:

Code Snippet

SELECT CAST(szF1 AS datetime) AS [Login Date/Time], szF2 AS [User Name], CAST(szF3 AS numeric) AS [Documents Indexed], CAST(szF4 AS datetime) AS [Logout Date/Time], CAST(szF5 AS numeric) AS [Documents Sent to QC], CAST(szF6 AS numeric) AS [Documents Reconciled], szF7 AS [Reject Reason], CAST(szF8 AS datetime) AS [Report Date]

FROM dbo.F_Report_Data AS a

WHERE (szF3 <> 'Blank')

When I open the view I get the error message about converting varchar to numeric.

Thanks,

Erik

Try running this query:

Code Snippet

SELECT CAST(szF1 AS datetime) AS [Login Date/Time],
szF2 AS [User Name],
-- CAST(szF3 AS numeric) AS [Documents Indexed],
szF3,
CAST(szF4 AS datetime) AS [Logout Date/Time],
-- CAST(szF5 AS numeric) AS [Documents Sent to QC],
-- CAST(szF6 AS numeric) AS [Documents Reconciled],
szF5,
szF6,
szF7 AS [Reject Reason],
CAST(szF8 AS datetime) AS [Report Date]
FROM dbo.F_Report_Data AS a
where isNumeric (szF3 + 'D0') = 0
or isNumeric (szF5 + 'D0') = 0
or isNumeric (szF6 + 'D0') = 0

And post any results that get returned.|||

I tried your suggestion and I got an error: "Error in list of function arguments: '=' not recognized. Unable to parse query text.

|||

It's likely because you have data in the szF5 or szF6 columns that can't be converted to numeric. For example, if I had the value aaa in szF5, I would get that error. More common is if I have a zero length string in the column, that can't be converted to numeric and I would get the error. A null would be fine but a zero length string would cause the error.

-Sue

|||

I would suggest (1) give the schema of the table and (2) give 5 sample rows of data from the table by doing a

select top 5 * from F_Report_Data

|||

The 3 columns that I want to cast as numeric have only numbers in them.

1/24/2007 9:58:03 AM admin 207 1/24/2007 2:08:55 PM 0 0 1/24/2007 12:00:00 AM
1/24/2007 9:59:03 AM admin 0 1/24/2007 4:09:25 PM 1 0 Unable to read case number 1/24/2007 12:00:00 AM
1/24/2007 9:56:03 AM admin 0 1/24/2007 4:26:33 PM 0 3 1/24/2007 12:00:00 AM
1/25/2007 1:55:19 PM admin 0 1/25/2007 3:32:51 PM 0 0 1/25/2007 12:00:00 AM
1/25/2007 1:55:19 PM test 0 1/25/2007 4:11:09 PM 1 0 Unable to read case number 1/25/2007 12:00:00 AM

The items in bold are thecolumns that I am trying to covnert/cast as numeric.

|||

The 3 columns that I want to cast as numeric have only numbers in them.

Code Snippet

1/24/2007 9:58:03 AM admin 207 1/24/2007 2:08:55 PM 0 0 1/24/2007 12:00:00 AM
1/24/2007 9:59:03 AM admin 0 1/24/2007 4:09:25 PM 1 0 Unable to read case number 1/24/2007 12:00:00 AM
1/24/2007 9:56:03 AM admin 0 1/24/2007 4:26:33 PM 0 3 1/24/2007 12:00:00 AM
1/25/2007 1:55:19 PM admin 0 1/25/2007 3:32:51 PM 0 0 1/25/2007 12:00:00 AM
1/25/2007 1:55:19 PM test 0 1/25/2007 4:11:09 PM 1 0 Unable to read case number 1/25/2007 12:00:00 AM

The items in bold are thecolumns that I am trying to covnert/cast as numeric.

Could you clarify by what you mean "Schema", it has been a while since my DB class and I am not a DBA. Every column is varchar(8000),null except for the PK which is (int, not null).

I awm giong to attempt to see if I can get the necessary results w/o convert/cast because there is supposed to be implicit conversion of varchar to numeric.

|||

Actually, you have answered the schema question -- all columns are varchar(8000) except for the PK which is integer -- a "wow" table. That should be enough for now. Try running this query and see if any results are returned:

Code Snippet

select left(szF1, 25) as szF1,
left(szF2, 25) as szF2,
left(szF3, 25) as szF3,
left(szF4, 25) as szF4,
left(szF5, 25) as szF5,
left(szF6, 25) as szF6,
left(szF7, 25) as szF7,
left(szF8, 25) as szF8
from dbo.F_Report_data
where isDate(szF1) = 0
or isNumeric (szF3 + 'D0') = 0
or isDate(szF4) = 0
or isNumeric (szF5 + 'D0') = 0
or isNumeric (szF6 + 'D0') = 0
or isDate(szF8) = 0

|||

Yes it returned a result, it's good that it returned a result but does that mean that we can/cannot convert/cast a varchar as a numeric? Thanks for your help!!

|||

Please post a sampling of the results that you received. It means that you will might either need to change the table or modify the way you display the data so that it is properly "clensed" -- you have dirty data.

|||

Here are the results:

Code Snippet

01/24/2007 09:58:03 AM admin 207 01/24/2007 02:08:55 PM 0 0 20070124
01/24/2007 09:59:03 AM admin 0 01/24/2007 04:09:25 PM 1 0 Unable to read case numbe 20070124
01/24/2007 09:56:03 AM admin 0 01/24/2007 04:26:33 PM 0 3 20070124
01/25/2007 01:55:19 PM admin 3 01/25/2007 03:32:51 PM 0 0 20070125

01/25/2007 01:55:19 PM test 0 01/25/2007 04:11:09 PM 1 0 Unable to read case numbe 20070125

| szf1| |szF2| szF3 |--szF4-| szF5 sz F6 |-szF7-| |szF8|

I just noticed that the query trimmed szF7 (Where it says "Unable to read case numbe"), I will need that field a little larger for the text. I never would have thought that there would be so much trouble to convert/cast a varchar to a numeric in a view.|||That did not display the same way it did on my screen when I was typing it. I hope it isn't too confusing.|||

Can somebody point Erik to an article about cleaning up data? My tests weren't strong enough and I really am not interested in wasting Erik's time. I suspect that blanks in his data caused the isNumeric tests to fail.

Erik:

You can try this query; it will exhibit which test is failing:

Code Snippet

select isDate(rtrim(szF1)) as szF1isDate,
isNumeric (rtrim(szF3) + 'D0') as szF3IsNumeric,
isDate(rtrim(szF4)) as szF4IsDate,
isNumeric (rtrim(szF5) + 'D0') as szF5IsNumeric,
isNumeric (rtrim(szF6) + 'D0') as szF6IsNumeric,
isDate(rtrim(szF8)) as szF8isDate,
left(szF1, 30) as szF1,
left(szF2, 30) as szF2,
left(szF3, 30) as szF3,
left(szF4, 30) as szF4,
left(szF5, 30) as szF5,
left(szF6, 30) as szF6,
left(szF7, 30) as szF7,
left(szF8, 30) as szF8
from dbo.F_Report_data
where isDate(rtrim(szF1)) = 0
or isNumeric (rtrim(szF3) + 'D0') = 0
or isDate(rtrim(szF4)) = 0
or isNumeric (rtrim(szF5) + 'D0') = 0
or isNumeric (rtrim(szF6) + 'D0') = 0
or isDate(rtrim(szF8)) = 0

I feel like I need a fresh set of eyes on this at this point. Help?

|||

Here are the results of the query. I don't really know what they are saying though, could you give me pseudo code explanation of the query?

0,1,0,1,1,0,,Blank,0,,0,0,,
1,1,1,0,0,1,01/25/2007 01:55:19 PM,admin,19,01/25/2007 04:11:43 PM,,,,20070125
1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 09:58:22 AM,1,0,Invalid case number,20070518
1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 10:01:14 AM,0,1,,20070518

|||

Erik:

To me the problem here is that the columns are not sufficiently typed; this is a design problem that should be fixed. If a column is intended to be used as a number it should be typed as numeric. Similarly, if a column is going to be used as a date it should be typed as a datetime column, not as a varchar. Here is the basic response to the records returned from the query:

0,1,0,1,1,0,,Blank,0,,0,0,,
this record failed for 3 reasons:
(1) The szF1 field is not a valid date (it is an empty string)
(2) The szF4 field is not a valid date (it is an empty string)
(3) the szF8 field is not a valid date (it is an empty string)

1,1,1,0,0,1,01/25/2007 01:55:19 PM,admin,19,01/25/2007 04:11:43 PM,,,,20070125
this record faild for two reasons:
(1) The szF5 field is not numeric (it is an empty string)
(2) the szF6 field is not numeric (it is an empty string)

]

1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 09:58:22 AM,1,0,Invalid case number,20070518
this record failed because:
(1) The szF3 field is not numeric (it is an empty string)

1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 10:01:14 AM,0,1,,20070518
this record failed because:
(1) The szF3 field is not numeric (it is an empty string)

Now, you might be able to use the NULLIF function to get around these problems since all of these are manifest when the column is an EMPTY string. If you are wanting to test for NUMERIC columns you might also want to give a look to this article about problems with the "isNumeric" built-in function:

http://classicasp.aspfaq.com/general/what-is-wrong-with-isnumeric.html

Error converting data type varchar to numeric

Hi,

Thank you in advance for your comments/suggestions. I am trying to create a View of a Table. The table is created by another application so I am unable to recreate it they way I want, also the data that is in the columns that I want to CAST are "numbers" not letters and will only be numbers. In the view I need certain columns to be CAST as numeric from varchar.

Here is the syntax that I am currently using:

Code Snippet

SELECT CAST(szF1 AS datetime) AS [Login Date/Time], szF2 AS [User Name], CAST(szF3 AS numeric) AS [Documents Indexed], CAST(szF4 AS datetime) AS [Logout Date/Time], CAST(szF5 AS numeric) AS [Documents Sent to QC], CAST(szF6 AS numeric) AS [Documents Reconciled], szF7 AS [Reject Reason], CAST(szF8 AS datetime) AS [Report Date]

FROM dbo.F_Report_Data AS a

WHERE (szF3 <> 'Blank')

When I open the view I get the error message about converting varchar to numeric.

Thanks,

Erik

Try running this query:

Code Snippet

SELECT CAST(szF1 AS datetime) AS [Login Date/Time],
szF2 AS [User Name],
-- CAST(szF3 AS numeric) AS [Documents Indexed],
szF3,
CAST(szF4 AS datetime) AS [Logout Date/Time],
-- CAST(szF5 AS numeric) AS [Documents Sent to QC],
-- CAST(szF6 AS numeric) AS [Documents Reconciled],
szF5,
szF6,
szF7 AS [Reject Reason],
CAST(szF8 AS datetime) AS [Report Date]
FROM dbo.F_Report_Data AS a
where isNumeric (szF3 + 'D0') = 0
or isNumeric (szF5 + 'D0') = 0
or isNumeric (szF6 + 'D0') = 0

And post any results that get returned.|||

I tried your suggestion and I got an error: "Error in list of function arguments: '=' not recognized. Unable to parse query text.

|||

It's likely because you have data in the szF5 or szF6 columns that can't be converted to numeric. For example, if I had the value aaa in szF5, I would get that error. More common is if I have a zero length string in the column, that can't be converted to numeric and I would get the error. A null would be fine but a zero length string would cause the error.

-Sue

|||

I would suggest (1) give the schema of the table and (2) give 5 sample rows of data from the table by doing a

select top 5 * from F_Report_Data

|||

The 3 columns that I want to cast as numeric have only numbers in them.

1/24/2007 9:58:03 AM admin 207 1/24/2007 2:08:55 PM 0 0 1/24/2007 12:00:00 AM
1/24/2007 9:59:03 AM admin 0 1/24/2007 4:09:25 PM 1 0 Unable to read case number 1/24/2007 12:00:00 AM
1/24/2007 9:56:03 AM admin 0 1/24/2007 4:26:33 PM 0 3 1/24/2007 12:00:00 AM
1/25/2007 1:55:19 PM admin 0 1/25/2007 3:32:51 PM 0 0 1/25/2007 12:00:00 AM
1/25/2007 1:55:19 PM test 0 1/25/2007 4:11:09 PM 1 0 Unable to read case number 1/25/2007 12:00:00 AM

The items in bold are thecolumns that I am trying to covnert/cast as numeric.

|||

The 3 columns that I want to cast as numeric have only numbers in them.

Code Snippet

1/24/2007 9:58:03 AM admin 207 1/24/2007 2:08:55 PM 0 0 1/24/2007 12:00:00 AM
1/24/2007 9:59:03 AM admin 0 1/24/2007 4:09:25 PM 1 0 Unable to read case number 1/24/2007 12:00:00 AM
1/24/2007 9:56:03 AM admin 0 1/24/2007 4:26:33 PM 0 3 1/24/2007 12:00:00 AM
1/25/2007 1:55:19 PM admin 0 1/25/2007 3:32:51 PM 0 0 1/25/2007 12:00:00 AM
1/25/2007 1:55:19 PM test 0 1/25/2007 4:11:09 PM 1 0 Unable to read case number 1/25/2007 12:00:00 AM

The items in bold are thecolumns that I am trying to covnert/cast as numeric.

Could you clarify by what you mean "Schema", it has been a while since my DB class and I am not a DBA. Every column is varchar(8000),null except for the PK which is (int, not null).

I awm giong to attempt to see if I can get the necessary results w/o convert/cast because there is supposed to be implicit conversion of varchar to numeric.

|||

Actually, you have answered the schema question -- all columns are varchar(8000) except for the PK which is integer -- a "wow" table. That should be enough for now. Try running this query and see if any results are returned:

Code Snippet

select left(szF1, 25) as szF1,
left(szF2, 25) as szF2,
left(szF3, 25) as szF3,
left(szF4, 25) as szF4,
left(szF5, 25) as szF5,
left(szF6, 25) as szF6,
left(szF7, 25) as szF7,
left(szF8, 25) as szF8
from dbo.F_Report_data
where isDate(szF1) = 0
or isNumeric (szF3 + 'D0') = 0
or isDate(szF4) = 0
or isNumeric (szF5 + 'D0') = 0
or isNumeric (szF6 + 'D0') = 0
or isDate(szF8) = 0

|||

Yes it returned a result, it's good that it returned a result but does that mean that we can/cannot convert/cast a varchar as a numeric? Thanks for your help!!

|||

Please post a sampling of the results that you received. It means that you will might either need to change the table or modify the way you display the data so that it is properly "clensed" -- you have dirty data.

|||

Here are the results:

Code Snippet

01/24/2007 09:58:03 AM admin 207 01/24/2007 02:08:55 PM 0 0 20070124
01/24/2007 09:59:03 AM admin 0 01/24/2007 04:09:25 PM 1 0 Unable to read case numbe 20070124
01/24/2007 09:56:03 AM admin 0 01/24/2007 04:26:33 PM 0 3 20070124
01/25/2007 01:55:19 PM admin 3 01/25/2007 03:32:51 PM 0 0 20070125

01/25/2007 01:55:19 PM test 0 01/25/2007 04:11:09 PM 1 0 Unable to read case numbe 20070125

| szf1| |szF2| szF3 |--szF4-| szF5 sz F6 |-szF7-| |szF8|

I just noticed that the query trimmed szF7 (Where it says "Unable to read case numbe"), I will need that field a little larger for the text. I never would have thought that there would be so much trouble to convert/cast a varchar to a numeric in a view.|||That did not display the same way it did on my screen when I was typing it. I hope it isn't too confusing.

|||

Can somebody point Erik to an article about cleaning up data? My tests weren't strong enough and I really am not interested in wasting Erik's time. I suspect that blanks in his data caused the isNumeric tests to fail.

Erik:

You can try this query; it will exhibit which test is failing:

Code Snippet

select isDate(rtrim(szF1)) as szF1isDate,
isNumeric (rtrim(szF3) + 'D0') as szF3IsNumeric,
isDate(rtrim(szF4)) as szF4IsDate,
isNumeric (rtrim(szF5) + 'D0') as szF5IsNumeric,
isNumeric (rtrim(szF6) + 'D0') as szF6IsNumeric,
isDate(rtrim(szF8)) as szF8isDate,
left(szF1, 30) as szF1,
left(szF2, 30) as szF2,
left(szF3, 30) as szF3,
left(szF4, 30) as szF4,
left(szF5, 30) as szF5,
left(szF6, 30) as szF6,
left(szF7, 30) as szF7,
left(szF8, 30) as szF8
from dbo.F_Report_data
where isDate(rtrim(szF1)) = 0
or isNumeric (rtrim(szF3) + 'D0') = 0
or isDate(rtrim(szF4)) = 0
or isNumeric (rtrim(szF5) + 'D0') = 0
or isNumeric (rtrim(szF6) + 'D0') = 0
or isDate(rtrim(szF8)) = 0

I feel like I need a fresh set of eyes on this at this point. Help?

|||

Here are the results of the query. I don't really know what they are saying though, could you give me pseudo code explanation of the query?

0,1,0,1,1,0,,Blank,0,,0,0,,
1,1,1,0,0,1,01/25/2007 01:55:19 PM,admin,19,01/25/2007 04:11:43 PM,,,,20070125
1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 09:58:22 AM,1,0,Invalid case number,20070518
1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 10:01:14 AM,0,1,,20070518

|||

Erik:

To me the problem here is that the columns are not sufficiently typed; this is a design problem that should be fixed. If a column is intended to be used as a number it should be typed as numeric. Similarly, if a column is going to be used as a date it should be typed as a datetime column, not as a varchar. Here is the basic response to the records returned from the query:

0,1,0,1,1,0,,Blank,0,,0,0,,
this record failed for 3 reasons:
(1) The szF1 field is not a valid date (it is an empty string)
(2) The szF4 field is not a valid date (it is an empty string)
(3) the szF8 field is not a valid date (it is an empty string)

1,1,1,0,0,1,01/25/2007 01:55:19 PM,admin,19,01/25/2007 04:11:43 PM,,,,20070125
this record faild for two reasons:
(1) The szF5 field is not numeric (it is an empty string)
(2) the szF6 field is not numeric (it is an empty string)

]

1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 09:58:22 AM,1,0,Invalid case number,20070518
this record failed because:
(1) The szF3 field is not numeric (it is an empty string)

1,0,1,1,1,1,05/18/2007 08:37:01 AM,ATRAIN28,,05/18/2007 10:01:14 AM,0,1,,20070518
this record failed because:
(1) The szF3 field is not numeric (it is an empty string)

Now, you might be able to use the NULLIF function to get around these problems since all of these are manifest when the column is an EMPTY string. If you are wanting to test for NUMERIC columns you might also want to give a look to this article about problems with the "isNumeric" built-in function:

http://classicasp.aspfaq.com/general/what-is-wrong-with-isnumeric.html

Error converting data type varchar to float.

Hi,

I am experencing a data type cast issue in T-SQL, basically our application comtains both numeric and non-numeric data in the same column, I want to retrieve the numeric data only.

Assuming a table has one column

create table TT(c1 varchar(20) )

and insert 2 rows into the table

insert into TT values('100')

insert into TT values('test')

Now if I want to do numeric comparison on column c1, I will get an error, e.g.

select * from TT where c1 >100

because SQL server trying to convert 'test' to a number impcilitly.

I tried to create an UDF to handle the non-numeric data conversion, e.g. if the data is numeric then return the number, if the data is non-numeric, then return a NULL.

create function numcast(@.value VARCHAR) returns numeric as

begin

begin try

declare @.rtnval numeric;

set @.rtnval = cast(@.value as numeric);

return(@.rtnval);

end try

begin catch

return(NULL);

end catch;

end;

There are 2 problems in above function, 1. it still failed on cast() function, 2. T-SQL function does support try-catch structure.

Does anybody know what the best solution to handle this kind of issues?

Many thanks

try this

select * from TT
where ISNUMERIC(c1 + 'e0')=1
and c1 > 100

Denis the SQL Menace

http://sqlservercode.blogspot.com/

|||Use the ISNUMERIC function to make sure the data is numeric before doing your comparison:

SELECT * FROM TT WHERE ISNUMERIC(c1) = 1 and c1 > 100

The query optimizer will only check the second part of the criteria (c1 > 100) if the first part is true. Note that if you flip the criteria, you will end up with a cast error again.|||

you can't just use ISNUMERIC, ISNUMERIC has a 'bug' isnumeric returns 1 for '1e4' for example

run the code below, that is why I use isnumeric( + 'e0')

declare @.v varchar(50)
select @.v ='1e4'
select isnumeric(@.v), isnumeric(@.v + 'e0')

Denis the SQL Menace

http://sqlservercode.blogspot.com/

|||Thanks for the info. I've never run into the problem using ISNUMERIC but sure enough your example does return the wrong info.

Is this 'bug' documented anywhere by Microsoft?|||

Not sure if it is documented anywhere but here is another one for you 1d2

declare @.v varchar(50)
select @.v ='1d2'
select isnumeric(@.v), isnumeric(@.v + 'e0')

Denis the SQL Menace
http://sqlservercode.blogspot.com/

|||

The isnumeric issue is not a bug. 1e4 is a valid number in scientific notation as well as 1d2, etc. The function works as expected, you just have to be aware of what it considers a number.

There is a better way to test if it is a valid integer, but, I am running short of time at the moment, so, this is untested but similiar to what you need using regular expression matching something like:

select col1 from table
where col1 LIKE '[0-9][0-9][0-9]'

|||

>>The isnumeric issue is not a bug.<<

Agreed

>> 1e4 is a valid number in scientific notation as well as 1d2, etc.<<

True

>> The function works as expected<<

Definitely false. But that is a limitation of the function. It is WAY too open. Vote for this as an improvement:

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=177308

I wholeheartedly agree that a parameter for type would help.

>>you just have to be aware of what it considers a number.<<

True again :)

|||

I agree with both of you that why I said 'bug' and not bug ;)

And yes IsInteger would be a nice addition to have as a function or as Louis suggested adding a parameter for type could also work

Denis the SQL Menace

http://sqlservercode.blogspot.com/

|||

>>And yes IsInteger would be a nice addition to have as a function or as Louis suggested adding a parameter for type could also work<<

Technically I was repeating what the poster in Connect said, but yes, either would be nice. A function per type?

|||Thank you all for your help, the information is so helpful to me.|||

The value "$1" also passes the isnumeric test, even though it can only be converted to a "money" datatype.

The problem with using LIKE '[0-9][0-9][0-9]' is that it doesn't account for variable length numbers.

I definitely vote for one function per type: isinteger, isdecimal, ismoney, etc.

Of course nowadays we can at least do something like this:

declare @.x varchar(10), @.y int

set @.x = ' 12x'

begin try select @.y = convert(int, @.x) end try

begin catch end catch

Ron

|||you can use col1 like '%[0-9]%'|||

>>you can use col1 like '%[0-9]%'

No you can't take a look at this


create table blah(col1 varchar(40))
insert into blah values('100')
insert into blah values('100B')
insert into blah values('1A00')
insert into blah values('A100')

select * from blah where col1 like '%[0-9]%'


Denis the SQL Menace
http://sqlservercode.blogspot.com/

Error converting data type varchar to datetime

An application i am using creates an error.

Using SQL-profiler i catch this statement:

exec sp_executesql N'insert into RECORDING_SCHEDULE (programme_oid, capture_source_oid, filename, status, recording_group, recording_type, manual_channel_oid,
manual_start_time, manual_end_time, quality_level, pre_pad_minutes, post_pad_minutes) values (@.P1,@.P2,@.P3,@.P4,@.P5,@.P6,@.P7,@.P8,@.P9,@.P10,@.P11,@.P1 2)',N'@.P1 int,@.P2 int,@.P3
nvarchar(19),@.P4 int,@.P5 int,@.P6 int,@.P7 int,@.P8 datetime,@.P9 datetime,@.P10 int,@.P11 int,@.P12 int',177748,2,N'Lilla rda traktorn',4,40,5,16,''2006-06-21
17:00:00:000'',''2006-06-21 20:00:00:000'',1,1,2

After removing the double ' around the date and time parts i get the following error when running in QA:
Msg 8114, Level 16, State 5, Line 0
Error converting data type varchar to datetime.

If a remove the time portion it works.

The DDL for the table is:

CREATE TABLE [dbo].[RECORDING_SCHEDULE](
[oid] [int] IDENTITY(1,1) NOT NULL,
[programme_oid] [int] NULL,
[capture_source_oid] [int] NULL,
[status] [smallint] NOT NULL,
[filename] [varchar](255) NULL,
[recording_type] [int] NULL,
[recording_group] [int] NULL,
[manual_start_time] [datetime] NULL,
[manual_end_time] [datetime] NULL,
[manual_channel_oid] [int] NULL,
[quality_level] [int] NULL CONSTRAINT [DF__RECORDING__quali__38996AB5] DEFAULT ((0)),
[pre_pad_minutes] [int] NULL CONSTRAINT [DF__RECORDING__pre_p__398D8EEE] DEFAULT ((0)),
[post_pad_minutes] [int] NULL CONSTRAINT [DF__RECORDING__post___3A81B327] DEFAULT ((0)),
CONSTRAINT [aaaaaRECORDING_SCHEDULE_PK] PRIMARY KEY NONCLUSTERED

What am I missing?Well, I corrected a type where you listed [@.P1 2] rather than the obviously intended [@.P12], but after that this code worked fine for me:CREATE TABLE [dbo].[RECORDING_SCHEDULETMP](
[oid] [int] IDENTITY(1,1) NOT NULL,
[programme_oid] [int] NULL,
[capture_source_oid] [int] NULL,
[status] [smallint] NOT NULL,
[filename] [varchar](255) NULL,
[recording_type] [int] NULL,
[recording_group] [int] NULL,
[manual_start_time] [datetime] NULL,
[manual_end_time] [datetime] NULL,
[manual_channel_oid] [int] NULL,
[quality_level] [int] NULL,
[pre_pad_minutes] [int] NULL,
[post_pad_minutes] [int] NULL,
)

exec sp_executesql N'
insert into RECORDING_SCHEDULETMP
(programme_oid,
capture_source_oid,
filename,
status,
recording_group,
recording_type,
manual_channel_oid,
manual_start_time,
manual_end_time,
quality_level,
pre_pad_minutes,
post_pad_minutes)
values (@.P1,
@.P2,
@.P3,
@.P4,
@.P5,
@.P6,
@.P7,
@.P8,
@.P9,
@.P10,
@.P11,
@.P12)',
N'@.P1 int,
@.P2 int,
@.P3 nvarchar(19),
@.P4 int,
@.P5 int,
@.P6 int,
@.P7 int,
@.P8 datetime,
@.P9 datetime,
@.P10 int,
@.P11 int,
@.P12 int',
177748,
2,
N'Lilla rda traktorn',
4,
40,
5,
16,
'2006-06-21 17:00:00:000',
'2006-06-21 20:00:00:000',
1,
1,
2

drop table RECORDING_SCHEDULETMPTry cutting and pasting this to QA and see if it runs for you.|||Oh, I think I see the issue. You "removed" the double quotes, when you should have just changed them to single quotes, as in my sample code...

Friday, March 9, 2012

Error Connection pooling ODBC - SQLConnect where Database this down

My application works with the Connection pooling ODBC. Everything works well, when it data base this down the SQLConnect function finishes steeply my application.

Sorry that I don't completely understand your scenario. Can you describe more clearly? Or can you post a short repro?

Thanks,

Junfeng

|||Database: MySql, Programming Language: C++

My application uses ODBC connection pooling, now when the database is operational everything works out fine, but as
soon as I stop it the SQLConnect function doesn't return the error but kills abruptly the application.

I've solved the problem... I've found it to be a bug in the MySql ODBC driver, I was working with version 3.51.10, when
I switched to 3.51.14 the problem dissapeared.

Thanks...

Error connecting to SQLExpress 2005 locally

Hello,
I'm a newbie here and was wondering anyone could help me with this.
I have a simple ASP.NET 2 web application running perfectly fine with
IIS and SQLServerExpress installed locally on my WinXP as a testing
server (I created the app in Visual Studio.NET 2005).
When deploying this app on the production server (running Win2000
Server, IIS and SQLServerExpress 2005), I'm getting the following
message when calling an aspx data-bound page from a browser:
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)
On the production server, I have the SQLServerExpress installed locally
on C: drive and the database is located on D: drive (on the same
directory as the app).
Connection string used in the webconfig file:
connectionString=" Server=SERVERNAME\SQLEXPRESS;AttachDbFil
ename=D:\Inetpub\A
pp_Data\registration. mdf;Database=registration;Trusted_Connec
tion=yes;"
providerName="System.Data.SqlClient"
Does anyone know how to solve this issue? Any help would be greatly
appreciated.
Thanks,
HarryHi
Have you checked if you are allowing remote connections on your SQL Express
installation, by default these will be switched off.
Check the Remote Connections setting the the SQL Server 2005 Surface Aread
Configuration tool.
John
"hko" wrote:

> Hello,
> I'm a newbie here and was wondering anyone could help me with this.
> I have a simple ASP.NET 2 web application running perfectly fine with
> IIS and SQLServerExpress installed locally on my WinXP as a testing
> server (I created the app in Visual Studio.NET 2005).
> When deploying this app on the production server (running Win2000
> Server, IIS and SQLServerExpress 2005), I'm getting the following
> message when calling an aspx data-bound page from a browser:
> 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)
> On the production server, I have the SQLServerExpress installed locally
> on C: drive and the database is located on D: drive (on the same
> directory as the app).
> Connection string used in the webconfig file:
> connectionString=" Server=SERVERNAME\SQLEXPRESS;AttachDbFil
ename=D:\Inetpub
\App_Data\registration. mdf;Database=registration;Trusted_Connec
tion=yes;"
> providerName="System.Data.SqlClient"
> Does anyone know how to solve this issue? Any help would be greatly
> appreciated.
> Thanks,
> Harry|||Hi John,
I did allow remote connections eventhough my database is on the same machine
as my web app, but no luck so far.
I used windows authentication for the database, and login to the machine
using admin account.
Another thing that I noticed is that when I go to SQL Server Configuration
Manager, under SQL Server 2005 Network Configuration, it says Protocols for
MSSQLSERVER, whereas on my dev machine it says SQLEXPRESS. When upgrading
from MSDE to SQLExpress i just chose the default instance name, but somehow
it's saying MSSQLSERVER.
I checked the databaseconnection through SQL Management Studio Express and
it works fine. Only when viewing the data-bound page on a browser that I get
the error message.
Do you think I should try to uninstall SQLServer Express and reinstall?
hko
"John Bell" wrote:
> Hi
> Have you checked if you are allowing remote connections on your SQL Expres
s
> installation, by default these will be switched off.
> Check the Remote Connections setting the the SQL Server 2005 Surface Aread
> Configuration tool.
> John
> "hko" wrote:
>|||Hi
If this is the default instance then change your connection string to only
be the servername.
If you want to change the installation from being the default instance you
will need to re-install.
John
"hko" wrote:
> Hi John,
> I did allow remote connections eventhough my database is on the same machi
ne
> as my web app, but no luck so far.
> I used windows authentication for the database, and login to the machine
> using admin account.
> Another thing that I noticed is that when I go to SQL Server Configuration
> Manager, under SQL Server 2005 Network Configuration, it says Protocols fo
r
> MSSQLSERVER, whereas on my dev machine it says SQLEXPRESS. When upgrading
> from MSDE to SQLExpress i just chose the default instance name, but someho
w
> it's saying MSSQLSERVER.
> I checked the databaseconnection through SQL Management Studio Express and
> it works fine. Only when viewing the data-bound page on a browser that I g
et
> the error message.
> Do you think I should try to uninstall SQLServer Express and reinstall?
> hko
> "John Bell" wrote:
>|||I only have one instance and that is the default instance, and this is my
connection string:
connectionString=" Server=HOMER\SQLEXPRESS;AttachDbFilename
=D:\Inetpub\App_Da
ta\registration. mdf;Database=registration;Trusted_Connec
tion=yes;"
providerName="System.Data.SqlClient"
Still something isn't right. Do you think I should probably re-install and
do fresh installation of SQL Express instead of upgrading (like what I did)?
"John Bell" wrote:
> Hi
> If this is the default instance then change your connection string to only
> be the servername.
> If you want to change the installation from being the default instance you
> will need to re-install.
> John
>
> "hko" wrote:
>|||Hi
Try the connection string:
connectionString=" Server=HOMER;AttachDbFilename=D:\Inetpub
\App_Data\registra
tion. mdf;Database=registration;Trusted_Connec
tion=yes;"
providerName="System.Data.SqlClient"
If you want a names instance then you would have to re-install and say that
you want a named instance and not the default instance.
John
"hko" wrote:
> I only have one instance and that is the default instance, and this is my
> connection string:
> connectionString=" Server=HOMER\SQLEXPRESS;AttachDbFilename
=D:\Inetpub\App_
Data\registration. mdf;Database=registration;Trusted_Connec
tion=yes;"
> providerName="System.Data.SqlClient"
> Still something isn't right. Do you think I should probably re-install and
> do fresh installation of SQL Express instead of upgrading (like what I did
)?
> "John Bell" wrote:
>|||Still not working. I tried different combination of connection strings but
kept getting the same error message.
I just want to use the default instance since there's only one database on
the machine.
I suspect there's a glitch during the upgrade process which causes SQL
server to locate the default instance. I was able to connect ok using
Management Studio Express.
This is the most frustrating thing ever to deal with...
"John Bell" wrote:
> Hi
> Try the connection string:
> connectionString=" Server=HOMER;AttachDbFilename=D:\Inetpub
\App_Data\regist
ration. mdf;Database=registration;Trusted_Connec
tion=yes;"
> providerName="System.Data.SqlClient"
> If you want a names instance then you would have to re-install and say tha
t
> you want a named instance and not the default instance.
> John
> "hko" wrote:
>|||Hi
A couple of suggestions:
Try using osql to try and connect, use both the server name and the IP
address and different user combinations.
Check that there is no blocking of the ports being used by a firewall (Try
telneting to the port!)
John
"hko" wrote:
> Still not working. I tried different combination of connection strings but
> kept getting the same error message.
> I just want to use the default instance since there's only one database on
> the machine.
> I suspect there's a glitch during the upgrade process which causes SQL
> server to locate the default instance. I was able to connect ok using
> Management Studio Express.
> This is the most frustrating thing ever to deal with...
> "John Bell" wrote:
>

Error connecting to SQL server

Hi,

We have a Windows 2000 terminal server with service pack 4 loaded.This has siebel application 7.8.2 .

We have another Windows 2003 standard edition server with service pack 1. This has SQL 2000 server with Service pack 4 installed.

When trying to connect to the sql server through odbc , i get an error


Microsoft SQL Server Login

Connection failed:
SQLState: '01000'
SQL Server Error: 10061
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen (Connect()).
Connection failed:
SQLState: '08001'
SQL Server Error: 17
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not exist or access denied.


OK

-I am able to ping the server and viceversa.

Please let me know how to resolve this problem

Then you either have a different port than 1433 (you will have to specify the portnumber after the instance / servername with the syntax --> default instance Servername,Portnumber ; Servername\InstanceName,Portnumber for named instances). Do you have a firewall installed ? Then you will have to check if the appropiate port for SQL are enabled.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de|||

Please follow the instruction and give us more details:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=362498&SiteID=1

|||

Hi

The port is configured to 1433

There is no firewall installed

does it happen due to ODBC version.?

|||

the issue is most likely that you are using terminal server and the odbc is a user odbc, and not a system odbc. if system odbc has not been created for the connection that is having the issue, create it.

ping uses icmp, and not always best test. test the odbc, recreate it if necessary. to check the 1433 port, open telnet client and type in telnet:1433; if it opens, the port is open, otherwise you know it's closed.

also check that the db is using the 1433 port (could have been configured to use alternate).

btw- i don't think siebel 7.8.2 is supported on 2000 server

Error connecting to SQL server

Hi,

We have a Windows 2000 terminal server with service pack 4 loaded.This has siebel application 7.8.2 .

We have another Windows 2003 standard edition server with service pack 1. This has SQL 2000 server with Service pack 4 installed.

When trying to connect to the sql server through odbc , i get an error


Microsoft SQL Server Login

Connection failed:
SQLState: '01000'
SQL Server Error: 10061
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen (Connect()).
Connection failed:
SQLState: '08001'
SQL Server Error: 17
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not exist or access denied.


OK

-I am able to ping the server and viceversa.

Please let me know how to resolve this problem

Then you either have a different port than 1433 (you will have to specify the portnumber after the instance / servername with the syntax --> default instance Servername,Portnumber ; Servername\InstanceName,Portnumber for named instances). Do you have a firewall installed ? Then you will have to check if the appropiate port for SQL are enabled.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de
|||

Please follow the instruction and give us more details:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=362498&SiteID=1

|||

Hi

The port is configured to 1433

There is no firewall installed

does it happen due to ODBC version.?

|||

the issue is most likely that you are using terminal server and the odbc is a user odbc, and not a system odbc. if system odbc has not been created for the connection that is having the issue, create it.

ping uses icmp, and not always best test. test the odbc, recreate it if necessary. to check the 1433 port, open telnet client and type in telnet:1433; if it opens, the port is open, otherwise you know it's closed.

also check that the db is using the 1433 port (could have been configured to use alternate).

btw- i don't think siebel 7.8.2 is supported on 2000 server

Error connecting to sql server

I have a perplexing problem. I've developed an ASP application for our internal business use. I'm getting ready to launch, but every once in a while the application can't connect to the database. The error I get is:

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)

We (IT and I) turned off the remote connections and it still happens. I'm afraid of launching without understanding what causes this and gettign a fix. To get it working again, we restart IIS and it works fine. I used VWD 2005 Express and it's running on SQL Server 2005 Express.

Thanks for any help you may have.
Scott J.

Don't let the bit about "does not allow remote connections" send you down the wrong path - this ridiculous error message is posted regardless of the actual problem (one of Microsoft's worst error messages).

The part to concentrate on is the final part of the error message, which differs depending on the actual error - in your case error: 40 - Could not open a connection to SQL Server. Are you sure that the SQL Express instance is actually running when you get this problem (is it periodically stopping?). Check it via the services applet - restarting IIS may simply be restarting the Express instance.

Wednesday, March 7, 2012

Error connecting to SQL 2000 db "The entry MCLConnectionString has already been added"

When I try to run my application using VWD from the file system I can connect and run the application and it connects to the remote SQL 2000 server with no problem.

However, when I publish to my web server I get the folloiwng error message:

Anyone got any ideas??

Configuration Error

Description:An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message:The entry 'MCLConnectionString' has already been added.

Source Error:

Line 11: <appSettings/>Line 12: <connectionStrings>Line 13: <add name="MCLConnectionString" connectionString="Data Source=GEACO1INTR1;Initial Catalog=MCL;Persist Security Info=True;User ID=ASPNET;Password=PAUL0001" providerName="System.Data.SqlClient"/>Line 14: </connectionStrings>Line 15: <system.web>


Source File:c:\inetpub\wwwroot\mcltest\web.config Line:13

I also notice that it works if I put the connection string in each form, but as soon as I try to add it to the web.config file I get the above error.

Thanks

Paul

|||

My guess is that you have a ConnectionString with the same name on a Parent Web Application, my advise would be either to change the name of the ConnectionString, or do this:

<connectionString>
<clear/>
<add name="MCLConnectionString" connectionString="..." />
</connectionStrings
Hope this Helps,

Roberto Hernandez-Pou
http://www.rhpconsulting.net

IMPORTANT: If you use the <clear/> to clean all connectionString keys, you would also be removing the ones for the SqlAuthenticationProvider and SqlRoleProvider.

|||

To add onto Roberto's reply...

If the MCLConnectionString does already exist higher in the configuration hierarchy, you don't have to add it again to use at this level. Remove it at this level's web.config and read the connection string as normal, and the configuration API will pick it up.

Don

|||

Thanks, that sorted it. I had a copy of the web.config file left in the root directory of the web server.

Thanks again for your help

Paul

Error Connecting to DB

I downloaded an ASP.NET web application from the web to learn the .NET framework. I was successful in running the website on my laptop using ASP.NET Development Server that comes with Visual Studio 2005. My laptop is running Windows XP Professional and SQL Server 2005. I am now trying to do the same on my desktop computer running Windows Vista; however, for some reason i am getting an error when the website tries to connect to the DB. Here are the steps i have followed so far:

1. I tried to configure the website DB connection the same way i configured it on my laptop. Basically I use the following connectionStrings:

<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=TheBeerHouse;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings
2. That same connection string worked fine on my laptop. But I got the following error on my desktop:

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)

I am wondering if the error is related to Vista. When i try to connect to that DB using SQL Management Studio via Windows Authetication and do not run it as Administrator then I cannot connect to the DB. In other words, only when i run SQL Management Studio as administrator i am able to use Windows authentication to connect to that DB.

3. Next, I tried creating a SQL login. I made sure I can use that login to access the DB directly using SQL Management Studio. In addition, I changed the database to allow "Local and remote connections" "Using both TCP/IP and named pipes".

4. Changed the connectionStrings in web.config to:

<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=TheBeerHouse;Integrated Security=False;uid=*****pwd=****" providerName="System.Data.SqlClient"/>
</connectionStrings
Obviously, the actual connectionString has the actual user name i created and the correct password instead of (*) asterisks.

5. And once again, I got same error as above

Any help will be appreciated!


Hi,

Is sqlserver on your desktop running in "Windows Authentication Mode" or "Mixed Mode"

Open up SqlServer Management Studio, right click on the Server, not the database(s), then in the left hand menu shown select Security. The dialog box on the right should have"SQL Server and Window Authentication Mode" checked instead of just"Windows Authentication Mode".

Hope this helps

Regards

ScottyB

|||

I have "SQL Server and Window Authentication Mode"checked. I can login directly to the database via SQL Managament Studio using the same login and password as specified in the connectionString. I also have allowedLocal and remote connections and haveUsingboth TCP/IP and named pipeschecked.

|||

Hi nj07208

I have just noticed in the connection string that you posted here that you do not have a semiclon after the uid and pwd parameters. You can try this. See the listings below

Original Connection String

<connectionStrings> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=TheBeerHouse;Integrated Security=False;uid=*****pwd=****" providerName="System.Data.SqlClient"/> </connectionStrings>

Modified Connection String

<connectionStrings> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=TheBeerHouse;Integrated Security=False;uid=*****;pwd=****"; providerName="System.Data.SqlClient"/> </connectionStrings>

Regards

ScottyB

|||

i guess you meant with the semicolon right after the password before the double quotes. I tried that and it didn't work =(

|||

I got a new error now! I turned off my firewalls (both Windows and McAfee ViruScan) and now i get a new error:

Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

Any ideas?


|||

If you have access to the iismanager try doing a pool reset or a iisreset.

Do you have any code in your application that goes through a loop and opens connections. This error may suggest you are opening connections faster than the garbage collector can dispose of them.

Regards

ScottyB

|||

I am using ASP.NET Development Server that comes with Visual Studio 2005. I am not using IIS.

|||

I got it!!! It works now!!! On the connectionString i changed Data Source from localhost to localhost\SQLEXPRESS. This is needed because I am using a named instance. So, to recap for anyone who is interested, these are the steps i followed:

1. EnableSQL Server and Windows Authentication mode. This can be done from SQL Management Studio

2. Create SQL Server login. Make sure you can login to the database using SQL Management Studio

3. EnableLocal and remote connections and haveUsingboth TCP/IP and named pipeschecked. This can be done from SQL Server Surface Area Configuration.

4. Connection String on web.config should be the following

<connectionStrings> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=TheBeerHouse;Integrated Security=False;uid=username;pwd=password;" providerName="System.Data.SqlClient"/></connectionStrings>
Note that I enabled both Windows and McAvfee AntiVirus firewalls and it still works.

Error connecting to datasource using bulk load

thanks for getting back to me. I am able to connect to the database
elsewhere in the application to call stored procedures and retrieve the
data to display. This is the only place within the application that I am
unable to connect. I suspect it has to do with the fact that I am
calling within a single thread. Here is the connect string:
"Data Source=(local);Initial Catalog=IOC;User
ID=sg2user;password=sg2user"
franksag
Posted via http://www.codecomments.com
Try setting the Provider=sqloledb value in the connection string. Here's an
example from our docs of Bulkload in .NET:
[STAThread]
static void Main(string[] args)
{
try
{
SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class objBL = new
SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class();
objBL.ConnectionString =
"Provider=sqloledb;server=server;database=database Name;integrated
security=SSPI";
objBL.ErrorLogFile = "error.xml";
objBL.KeepIdentity = false;
objBL.Execute ("schema.xml","data.xml");
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
"franksag" <franksag.1llvtp@.mail.codecomments.com> wrote in message
news:franksag.1llvtp@.mail.codecomments.com...
> thanks for getting back to me. I am able to connect to the database
> elsewhere in the application to call stored procedures and retrieve the
> data to display. This is the only place within the application that I am
> unable to connect. I suspect it has to do with the fact that I am
> calling within a single thread. Here is the connect string:
> "Data Source=(local);Initial Catalog=IOC;User
> ID=sg2user;password=sg2user"
>
> --
> franksag
> Posted via http://www.codecomments.com
>

Sunday, February 26, 2012

Error connecting to .sdf database

Dear All,

I am trying to connect to a .sdf database. I am building a console application. First I got an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". Then I manage to solve "Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". So wat is the possible error on my side ?

Is it not amazing. I have been searching the forums for a solution to this specific problem for weeks now and everyone that answers has no idea what it is we are requesting. you get redirected to a thousand other sites that still can not answer this question. I dont think anyone knows how to solve this!

|||

Which version of the product are you using?

Checking the basics first: Is the product installed on your machine ( check in Add and remove programs).Also check that the System.Data.SqlServerCe.dll is in GAC (C:\windows\assembly).

If your installation was correct, then sqlceme30.dll (and other dlls) should be loaded automatically using some registry settings.

Btw, did you try reinstalling the runtime package on your machine?

Error connecting to .sdf database

Dear All,

I am trying to connect to a .sdf database. I am building a console application. First I got an error "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". Then I manage to solve "Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". So wat is the possible error on my side ?

Is it not amazing. I have been searching the forums for a solution to this specific problem for weeks now and everyone that answers has no idea what it is we are requesting. you get redirected to a thousand other sites that still can not answer this question. I dont think anyone knows how to solve this!

|||

Which version of the product are you using?

Checking the basics first: Is the product installed on your machine ( check in Add and remove programs).Also check that the System.Data.SqlServerCe.dll is in GAC (C:\windows\assembly).

If your installation was correct, then sqlceme30.dll (and other dlls) should be loaded automatically using some registry settings.

Btw, did you try reinstalling the runtime package on your machine?

Friday, February 17, 2012

Error at: The user is not associated with a trusted SQL Server connection

Hi I've got a common error using SQL server 2005

"The user is not associated with a trusted SQL Server connection"

I'm building a application using C# when using a standalone environment, it worked well. But, now I have the following environment.

A.
SQL server
Domain XXX

B. Remote machine
Application
Domain YYY

I changed SQL server to support SQL and WIN authentication mode and I have changed SQl server surface area configuration to support TCP/IP and Named Pipes for remote connections. But I still have two problems:

1. When using the IP - serverName of the dataserver, the error is

System.Data.SqlClient.SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection..

1. When using the server name(MYServerName), I have this error:
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Besides, I have tried from my remote machine to use a sqlcmd -E -S tcp:myhost command but I have the same answer.

Any help, I will thank.I believe you set Mixed Authentication in your SQL server in the domain XXX.
And you have an NT login in the application YYY domain.

You could try two things:

Check if you have the same NT login in XXX domain.
The XXX domain needs to trust the YYY domain to allow this to occur. You
could use SQL Server authentication instead if you don't want this trust to
occur. Trouble is you need to pass the password for the SQL login, but worth to try.|||this should work as long as the xxx domain trusts the yyy domain. if it doesn't, windows auth won't work.

is it possible to login to a box in XXX with an nt account in YYY? if not then there is no trust.