Showing posts with label connection. Show all posts
Showing posts with label connection. Show all posts

Thursday, March 29, 2012

Error when updating database

Hi all,
I'm getting an error when updating my database. The connection is fine and the dropdown menu is good also so i think it's the way i've formed my sql string. Here's the line i think i'm having probs with:

SQLString = "UPDATE project_descriptions SET " & _
"lecturer_name = '" & Replace(LecturerName.Text,"'","''") & "'," & _
"project_title = '" & Replace(ProjectTitle.Text,"'","''") & "', " & _
"Project_description = '" & Replace(ProjectDescription.Text,"'","''") & "'," & _
" WHERE project_code = '" & ProjectCode.SelectedItem.Value & "'"

Can anyone rearrange it so i stop getting an error?

Here's my code. if it helps.

<%@. Import Namespace="System.Data.OleDb" %
<SCRIPT language="VB" runat="server"
Dim DBConnection As OleDbConnection
Dim DBCommand As OleDbCommand
Dim DBReader As OleDbDataReader
Dim SQLString As String

Sub Page_Load

If Not Page.IsPostBack Then

'-- Load drop-down list with item numbers
DBConnection = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\finalyearproject2\projectallocation.mdb")
DBConnection.Open()
SQLString = "SELECT project_code FROM project_descriptions ORDER BY project_code"
DBCommand = New OleDbCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
ProjectCode.DataSource = DBReader
ProjectCode.DataTextField = "project_code"
ProjectCode.DataValueField = "project_code"
ProjectCode.DataBind()
DBReader.Close()
DBConnection.Close()

End If

End Sub

Sub SelectRecord (Src As Object, Args As EventArgs)

DBConnection = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\finalyearproject2\projectallocation.mdb")
DBConnection.Open()
SQLString = "SELECT * FROM project_descriptions WHERE " & _
"project_code = '" & ProjectCode.SelectedItem.Value & "'"
DBCommand = New OleDbCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
DBReader.Read()
LecturerName.Text = DBReader("lecturer_name")
ProjectTitle.Text = DBReader("project_title")
ProjectDescription.Text = DBReader("project_description")
DBReader.Close()
DBConnection.Close()
UpdateButton.Visible = True

End Sub

Sub UpdateRecord (Src As Object, Args As EventArgs)

'-- CHECK FOR VALID RECORD --
Dim ValidRecord As Boolean = True

'-- Check for missing Project Title
If ProjectTitle.Text = "" Then
ProjectTitleMessage.Text = "Missing Project Title"
ValidRecord = False
End If

'-- Check for missing Lecturer Name
If LecturerName.Text = "" Then
LecturerNameMessage.Text = "Missing Lecturer Name"
ValidRecord = False
End If

'-- Check for missing Project Description
If ProjectDescription.Text = "" Then
ProjectDescriptionMessage.Text = "Missing Project Description"
ValidRecord = False
End If

If ValidRecord = True Then

'-- UPDATE A RECORD --
Try
DBConnection = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\finalyearproject2\projectallocation.mdb")
DBConnection.Open()

SQLString = "UPDATE project_descriptions SET " "lecturer_name = '" & Replace(LecturerName.Text,"'","''") & "'," "project_title = '" & Replace(ProjectTitle.Text,"'","''") & "', " "Project_description = '" & Replace(ProjectDescription.Text,"'","''") & "'," " WHERE project_code = '" & ProjectCode.SelectedItem.Value & "'"
DBCommand = New OleDbCommand(SQLString, DBConnection)
DBCommand.ExecuteNonQuery
DBConnection.Close()
UpdateMessage.Text = "Record updated"
Catch
UpdateMessage.Text = "Update problem. Record not changed. " & SQLString
End Try

End If

End Sub

</SCRIPT
<html>
<head
<style>
.head {font-family:arial; font-size:12pt; font-weight:bold; width:560px;
border:outset 1 #F0F0F0; padding:2pt; background-color:#990000;
color:#FFFFFF; text-align:center}
.box {font-family:arial; font-size:8pt; line-height:9pt; width:200px;
height:20px; overflow:auto}
.right {text-align:right}
.center {text-align:center}
table {font-family:arial; font-size:8pt; line-height:9pt; width:560px;
background-color:#F9F9F9; border-collapse:collapse}
th {font-family:arial; font-size:8pt; line-height:14pt;
font-weight:bold; text-align:center; vertical-align:bottom;
background-color:#990000; color:#FFFFFF}
td {font-family:arial; font-size:8pt; line-height:9pt;
vertical-align:top}
</style>
</head
<body>
<form runat="server"
<div class="head">Project Update</div
<table id="UpdateTable" border="1" rules="rows">
<tr>
<th> Project Code: </th>
<td><asp:DropDownList id="ProjectCode" runat="server"/>
<asp:Button Text="Select" OnClick="SelectRecord" runat="server"/>
</td>
<td></td>
</tr>
<tr>
<th> Lecturer Name: </th>
<td><asp:TextBox id="LecturerName" runat="server"
Columns="40"
MaxLength="50"/></td>
<td><asp:Label id="LecturerNameMessage" runat="server"
ForeColor="#FF0000"
EnableViewState="False"/></td>
</tr
<tr>
<th> Project Title: </th>
<td><asp:TextBox id="ProjectTitle" runat="server"
Columns="40"
MaxLength="50"/></td>
<td><asp:Label id="ProjectTitleMessage" runat="server"
ForeColor="#FF0000"
EnableViewState="False"/></td>
</tr
<tr>
<th> Project Description: </th>
<td><asp:TextBox id="ProjectDescription" runat="server"
TextMode="MultiLine"
Columns="45"
rows="3"/></td>
<td><asp:Label id="ProjectDescriptionMessage" runat="server"
ForeColor="#FF0000"
EnableViewState="False"/></td>
</tr
</asp:Panel
</table>
<br>
<asp:Button id="UpdateButton" runat="server"
Text="Update Record"
Visible="False"
OnClick="UpdateRecord"/>
<asp:Label id="UpdateMessage" runat="server"
ForeColor="#FF0000"
EnableViewState="False"/>
</form>
</body>
</html>Please, please use parameterized SQL statements, not SQL statements concatenated together with user-supplied data!! What you have now is exposing your application/server/network to SQL injection attacks.

See theServer Side Data Access QuickStart Tutorial, in particularInserting Data in a SQL Database. The techniques used here should be directly applicable to your situation.

Terri|||Thanks for the reply Terri, but in this case I have to do it this way (long story). Any ideas?|||You should post exact error messages -- these go a long way to solving the problem. I am reasonably sure the problem is that you have a comma before your WHERE.

It would be interesting to know why you have to do it this way. It is an ill-advised practice and I have to strongly urge you to use parameters instead.

Terri|||Got it workin, thanks a lot!!! This method is for an assignment. We have to do it both ways. Thanks againsql

Error when trying to log in to SQL server

I've just finished developing a web app, which works fine on my PC, running IIS locally. It uses windows authentication and a trusted connection to retrieve data from SQL server. So far so routine. When I deploy the app to my live server, it returns the error:

Login failed for user '\'

The stack trace seems to indicate that it's at the point where the app tries to retrieve data that the error occurs. I proved this by changing my connection string to explicitly define the log on, and it retrieved the data no problem.

I set up a very simple webform with a label on, to return what it thought the user's log on name was, and it returns the correct name.

Any ideas as to why the username isn't being correctly passed to SQL server?Have you made sure the Web Account is a valid user of the SQL Server? If the IIS box and the SQL box are different you have to ensure the user has network rights too.|||Yes, the user (me!) definitely has rights on the SQL server. How come it works locally on my PC, but not on the server?

What network rights do you think I should investigate?

Thanks.|||Sorry I mis-read your original post, I didn't notice that your site was using NT Authentication. So here is my mental checklist:
1. Web Server has access to the Domain server to authenticate the user
2. The Web Server isn't the Domain Server
3. SQL Server security logins knows about the Windows user/user group
4. The SQL Database knows about the Windows user/user group

I mentioned the network security because when you use anon web access the user must have network access to go across machines. That "shouldn't" be an issue here.

Also run SQL Profiler to see if the user is getting set to SQL and then going wrong. Sounds more like its a problem on the web server though, something wrong with the impersonation.|||I'm positive that the user is being authenticated properly on the app, because when I load a simple page with a label which displays the user name, it displays correctly. For some reason this user name isn't getting passed to SQL server correctly.

I tried deploying the application to the box which has the SQL server running, and gess what? It worked. So does this mean that the first box can't access the domain server? Any idea how I can check that?

I'll have a think, and let you know how I get on.

Cheers.|||Hang on, just cause you're using Web Authentication doesn't mean it will impersonate the user onto SQL Server. Do you set the principal security when the user connects?

Check out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch03.asp

Error when trying to deploy

I am getting this error when trying to deploy a report. As far as I can see
permissions /Authentication is all ok
A connection could not be made to the report server
http://Servername/ReportServer
Anybody have any ideas of where to start looking?Have you checked the report project properties? Right mouse on your project
and select "Properties" and be sure the TargetServerURL points to the
correct deploy server (i.e. http://hostname/ReportServer).
"PaulM" <PaulM@.discussions.microsoft.com> wrote in message
news:63646412-BB77-438B-9A45-E4723AE5262C@.microsoft.com...
>I am getting this error when trying to deploy a report. As far as I can see
> permissions /Authentication is all ok
> A connection could not be made to the report server
> http://Servername/ReportServer
> Anybody have any ideas of where to start looking?
>|||I was having this same problem on a new PC that I had just setup with .NET
and SQL Reporting. I found that I needed to have the "Bypass proxy server
for local addresses" checkbox checked in my IE browser connection settings.
I found this by comparing to my old PC.
"goodman93" wrote:
> Have you checked the report project properties? Right mouse on your project
> and select "Properties" and be sure the TargetServerURL points to the
> correct deploy server (i.e. http://hostname/ReportServer).
>
> "PaulM" <PaulM@.discussions.microsoft.com> wrote in message
> news:63646412-BB77-438B-9A45-E4723AE5262C@.microsoft.com...
> >I am getting this error when trying to deploy a report. As far as I can see
> > permissions /Authentication is all ok
> >
> > A connection could not be made to the report server
> > http://Servername/ReportServer
> >
> > Anybody have any ideas of where to start looking?
> >
> >
>
>

Tuesday, March 27, 2012

error when trying to browse SSRS on a remote machine

Hi,

I deployed SSRS reports to my local report server and set the connection string to access a server on the network with Analysis Server.

Result:
I can access and use the reports from my computer. But when I use any other computer on the network I can't use the reports. I can access them but they don't find the database ant therefor they don't present any data.

Error message as folows: "An error has occurred during report processing. (rsProcessingAborted) Get Online Help
Cannot create a connection to data source 'dsAnalys'. (rsErrorOpeningConnection) Get Online Help
Database 'Analys' does not exist.
"

This works fine on my local machine, the error comes only when i try to browse on a remote machine. I am using SQL Server 2005

Any help would be appriciated!!!

Thanks in advance,

Chanduu

Can you access the database from a different PC using SQL Server Management Studio?

Possibly the server is not accessible from those PCs? Is it on a different domain?

|||yes, i am able to access|||

Chandu I am just trying to see what is causing this error.

1.) Do you have Shared Datasource in SSRS.

2.) While deploying to the remote server, make sure to include the right TargetServerUrl.

3.) On the Remote Server, go the Home folder and check for the DataSources if it has

a.) Enable this Data Source CheckBox checked.

b.) Connection string

c.) In the Connect Using: Check if the Credentials stored securely in the report server is Checked and the UserName and Password is given.

4.) Check for the permissions.

Hope this helps...

|||

Thanks a lot !!! friends .. I got answer for this error

Steps i followed to reslove this error

1. Goto http://<report server>/reports

2. Select the datasource folder

3. Check "Credentials stored in that report" and give valid user id and password

4. Check the check box"Use as windows credentials when connecting to datasource"

error when trying to browse SSRS on a remote machine

Hi,

I deployed SSRS reports to my local report server and set the connection string to access a server on the network with Analysis Server.

Result:
I can access and use the reports from my computer. But when I use any other computer on the network I can't use the reports. I can access them but they don't find the database ant therefor they don't present any data.

Error message as folows: "An error has occurred during report processing. (rsProcessingAborted) Get Online Help
Cannot create a connection to data source 'dsAnalys'. (rsErrorOpeningConnection) Get Online Help
Database 'Analys' does not exist.
"

This works fine on my local machine, the error comes only when i try to browse on a remote machine. I am using SQL Server 2005

Any help would be appriciated!!!

Thanks in advance,

Chanduu

Can you access the database from a different PC using SQL Server Management Studio?

Possibly the server is not accessible from those PCs? Is it on a different domain?

|||yes, i am able to access|||

Chandu I am just trying to see what is causing this error.

1.) Do you have Shared Datasource in SSRS.

2.) While deploying to the remote server, make sure to include the right TargetServerUrl.

3.) On the Remote Server, go the Home folder and check for the DataSources if it has

a.) Enable this Data Source CheckBox checked.

b.) Connection string

c.) In the Connect Using: Check if the Credentials stored securely in the report server is Checked and the UserName and Password is given.

4.) Check for the permissions.

Hope this helps...

|||

Thanks a lot !!! friends .. I got answer for this error

Steps i followed to reslove this error

1. Goto http://<report server>/reports

2. Select the datasource folder

3. Check "Credentials stored in that report" and give valid user id and password

4. Check the check box"Use as windows credentials when connecting to datasource"

sql

error when trying to browse SSRS on a remote machine

Hi,

I deployed SSRS reports to my local report server and set the connection string to access a server on the network with Analysis Server.

Result:
I can access and use the reports from my computer. But when I use any other computer on the network I can't use the reports. I can access them but they don't find the database ant therefor they don't present any data.

Error message as folows: "An error has occurred during report processing. (rsProcessingAborted) Get Online Help
Cannot create a connection to data source 'dsAnalys'. (rsErrorOpeningConnection) Get Online Help
Database 'Analys' does not exist.
"

This works fine on my local machine, the error comes only when i try to browse on a remote machine. I am using SQL Server 2005

Any help would be appriciated!!!

Thanks in advance,

Chanduu

Can you access the database from a different PC using SQL Server Management Studio?

Possibly the server is not accessible from those PCs? Is it on a different domain?

|||yes, i am able to access|||

Chandu I am just trying to see what is causing this error.

1.) Do you have Shared Datasource in SSRS.

2.) While deploying to the remote server, make sure to include the right TargetServerUrl.

3.) On the Remote Server, go the Home folder and check for the DataSources if it has

a.) Enable this Data Source CheckBox checked.

b.) Connection string

c.) In the Connect Using: Check if the Credentials stored securely in the report server is Checked and the UserName and Password is given.

4.) Check for the permissions.

Hope this helps...

|||

Thanks a lot !!! friends .. I got answer for this error

Steps i followed to reslove this error

1. Goto http://<report server>/reports

2. Select the datasource folder

3. Check "Credentials stored in that report" and give valid user id and password

4. Check the check box"Use as windows credentials when connecting to datasource"

Error when running SQL Job

I get an Event ID: 40961 when running a job in SQL the error message is as follows;
The Security System could not establish a secured connection with the server MSSQLSvc/PTISERV.Pinnacle.PTI:1433. No authentication protocol was available.
The job is run on another server and is trying to hit the server listed above.
There are a few related knowledge base articles and several
reasons for the error listed at this site:
http://www.eventid.net/display.asp?e...aS rv&phase=1
-Sue
On Tue, 18 May 2004 04:46:04 -0700, "JZanone"
<anonymous@.discussions.microsoft.com> wrote:

>I get an Event ID: 40961 when running a job in SQL the error message is as follows;
>The Security System could not establish a secured connection with the server MSSQLSvc/PTISERV.Pinnacle.PTI:1433. No authentication protocol was available.
>The job is run on another server and is trying to hit the server listed above.

Error when running SQL Job

I get an Event ID: 40961 when running a job in SQL the error message is as f
ollows;
The Security System could not establish a secured connection with the server
MSSQLSvc/PTISERV.Pinnacle.PTI:1433. No authentication protocol was availab
le.
The job is run on another server and is trying to hit the server listed abov
e.There are a few related knowledge base articles and several
reasons for the error listed at this site:
1" target="_blank">http://www.eventid.net/display.asp?...phase=
1
-Sue
On Tue, 18 May 2004 04:46:04 -0700, "JZanone"
<anonymous@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>I get an Event ID: 40961 when running a job in SQL the error message is as
follows;
>The Security System could not establish a secured connection with the serve
r MSSQLSvc/PTISERV.Pinnacle.PTI:1433. No authentication protocol was availa
ble.
>The job is run on another server and is trying to hit the server listed above.[/vbc
ol]sql

Error when running SQL Job

I get an Event ID: 40961 when running a job in SQL the error message is as follows
The Security System could not establish a secured connection with the server MSSQLSvc/PTISERV.Pinnacle.PTI:1433. No authentication protocol was available
The job is run on another server and is trying to hit the server listed above.There are a few related knowledge base articles and several
reasons for the error listed at this site:
http://www.eventid.net/display.asp?eventid=40961&eventno=1398&source=LsaSrv&phase=1
-Sue
On Tue, 18 May 2004 04:46:04 -0700, "JZanone"
<anonymous@.discussions.microsoft.com> wrote:
>I get an Event ID: 40961 when running a job in SQL the error message is as follows;
>The Security System could not establish a secured connection with the server MSSQLSvc/PTISERV.Pinnacle.PTI:1433. No authentication protocol was available.
>The job is run on another server and is trying to hit the server listed above.

Friday, March 23, 2012

Error when logging on to sql server proper

I am getting the following error.

"The user instance login flag is not supported on this version of SQL Server. The connection will be closed."

Background i created a site on my development machine, and every thing worked, this computer is running sql EX. I uploaded the site to the production server (running sql 2005 standard) and changed the connection string (i have used this connection string with other dB's to display data only, and it works) but i tried it with the ASPNETDB.mdf in the AppData folder and i get the above message.

Do i have to set some special permissions in the db for it to work. I need to be able to insert, update, and delete in this app.

The definition for the 'User Instance' attribute in connection string is as following:

User Instance

A value that indicates whether to redirect the connection from the default SQL Server Express instance to a runtime-initiated instance running under the account of the caller.

So I guess this attribute only make sense todefault SQL Server Express intance? I've tried to set 'User Instance' to true and connect to SQL of other versions(2000 and 2005), all failed with the smae error as you got.|||

I have been able to setup a db that will allow me to do the updates and inserts but with the ASPNETDB.MDF no go. This is the string i'm using:

<connectionStrings>

<addname="ConnectionString"connectionString="server=serversName\XPRESS;uid=aspuser;pwd=aspuserPassworkd;database=DATABName" />

</connectionStrings>

|||

It was a problem with permissions and use. Needed to set user to odb

Thanks for the help though

Monday, March 19, 2012

Error when creating new connection in DTS Designer

64b SQL2005 EE and all clent tools installed on the same server. Im trying to create a new connection in DTS Designer but after succesful test of the connection it errors out with

The new connection manager couldnt be created. Additional info : Exeption from HRESULT 0xC0010014

Any idea whats the problem here?

This might be caused by a problem described here:

http://support.microsoft.com/kb/913817

|||Im logged in with local admin account. Does that count? Still SSIS is running under Network Servise|||Usually the service does the component enumeration and caches the results, so this is performed without admin rights. You can check if this is an issue by temporary disabling the service, and trying this again (restart BIDS first). If this is caused by permission issue, you'll likely succeed because BIDS will do the component enumeration itself (this harms performance, but avoids Network Service restrictions).

Friday, March 9, 2012

Error viewing cube from Excel

When attempting to connect to an OLAP cube from excel. The Multidimensional Connection returns the error: "Unable to open connection. Cannot connect to the server 'myServername'. The server is either not started or too busy." Can someone please help to resolve this?

Take a look at the connection troubleshooting guide here: http://www.sqljunkies.com/WebLog/edwardm/

Another suggestion, try and repair your office installation by going through Add/Remove programs in Control panel.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

Wednesday, March 7, 2012

Error using OPENROWSET in a proc

I am getting the following error message "Heterogeneous
queries require the ANSI_NULLS and ANSI_WARNINGS options
to be set for the connection. This ensures consistent
query semantics. Enable these options and then reissue
your query." and setting
ANSI_NULL and ANSI_WARNINGS explicitly in the proc don't
seem to fix it. Here is my code:
CREATE PROCEDURE osp_importexcel
@.filename varchar(1000)
AS
Set ANSI_NULLS ON
Set ANSI_WARNINGS ON
declare @.sqlst as nvarchar(1000)
set @.sqlst = 'drop table Mailing'
exec sp_sqlexec @.sqlst
set @.sqlst = 'select * into Mailing from OPENROWSET
(''Microsoft.Jet.OLEDB.4.0'',
''Excel
8.0;Database='+@.filename+''', [Data$])'
exec sp_sqlexec @.sqlst
GO
Any ideas?
Thanks much in advanceDirectly from BOL
For stored procedures, SQL Server uses the SET ANSI_NULLS setting value from
the initial creation time of the stored procedure. Whenever the stored
procedure is subsequently executed, the setting of SET ANSI_NULLS is
restored to its originally used value and takes effect. When invoked inside
a stored procedure, the setting of SET ANSI_NULLS is not changed.
and
SQL Server saves the settings of both SET QUOTED_IDENTIFIER and SET
ANSI_NULLS when a stored procedure is created or altered. These original
settings are used when the stored procedure is executed. Therefore, any
client session settings for SET QUOTED_IDENTIFIER and SET ANSI_NULLS are
ignored during stored procedure execution. SET QUOTED_IDENTIFIER and SET
ANSI_NULLS statements that occur within the stored procedure do not affect
the functionality of the stored procedure.
"shiggins_dev" <shiggins_dev@.yahoo.com> wrote in message
news:008b01c3d61d$e358d030$a601280a@.phx.gbl...
quote:

> I am getting the following error message "Heterogeneous
> queries require the ANSI_NULLS and ANSI_WARNINGS options
> to be set for the connection. This ensures consistent
> query semantics. Enable these options and then reissue
> your query." and setting
> ANSI_NULL and ANSI_WARNINGS explicitly in the proc don't
> seem to fix it. Here is my code:
> CREATE PROCEDURE osp_importexcel
> @.filename varchar(1000)
> AS
> Set ANSI_NULLS ON
> Set ANSI_WARNINGS ON
> declare @.sqlst as nvarchar(1000)
> set @.sqlst = 'drop table Mailing'
> exec sp_sqlexec @.sqlst
> set @.sqlst = 'select * into Mailing from OPENROWSET
> (''Microsoft.Jet.OLEDB.4.0'',
> ''Excel
> 8.0;Database='+@.filename+''', [Data$])'
> exec sp_sqlexec @.sqlst
> GO
> Any ideas?
> Thanks much in advance
>
|||Thanks Scott. So I made sure the server and db has
ANSI_NULLS and ANSI_WARNINGS
quote:

>--Original Message--
>Directly from BOL
>For stored procedures, SQL Server uses the SET ANSI_NULLS

setting value from
quote:

>the initial creation time of the stored procedure.

Whenever the stored
quote:

>procedure is subsequently executed, the setting of SET

ANSI_NULLS is
quote:

>restored to its originally used value and takes effect.

When invoked inside
quote:

>a stored procedure, the setting of SET ANSI_NULLS is not

changed.
quote:

>and
>SQL Server saves the settings of both SET

QUOTED_IDENTIFIER and SET
quote:

>ANSI_NULLS when a stored procedure is created or altered.

These original
quote:

>settings are used when the stored procedure is executed.

Therefore, any
quote:

>client session settings for SET QUOTED_IDENTIFIER and SET

ANSI_NULLS are
quote:

>ignored during stored procedure execution. SET

QUOTED_IDENTIFIER and SET
quote:

>ANSI_NULLS statements that occur within the stored

procedure do not affect
quote:

>the functionality of the stored procedure.
>
>"shiggins_dev" <shiggins_dev@.yahoo.com> wrote in message
>news:008b01c3d61d$e358d030$a601280a@.phx.gbl...
>
>.
>
|||I suffer from premature submission...anyway.
Thanks Scott. I made sure the Server and the DB both have
ANSI_NULLS AND ANSI_WARNINGS set to on then I recreated my
proc and I still get the same error. Any other ideas?
Thanks.
quote:

>--Original Message--
>Directly from BOL
>For stored procedures, SQL Server uses the SET ANSI_NULLS

setting value from
quote:

>the initial creation time of the stored procedure.

Whenever the stored
quote:

>procedure is subsequently executed, the setting of SET

ANSI_NULLS is
quote:

>restored to its originally used value and takes effect.

When invoked inside
quote:

>a stored procedure, the setting of SET ANSI_NULLS is not

changed.
quote:

>and
>SQL Server saves the settings of both SET

QUOTED_IDENTIFIER and SET
quote:

>ANSI_NULLS when a stored procedure is created or altered.

These original
quote:

>settings are used when the stored procedure is executed.

Therefore, any
quote:

>client session settings for SET QUOTED_IDENTIFIER and SET

ANSI_NULLS are
quote:

>ignored during stored procedure execution. SET

QUOTED_IDENTIFIER and SET
quote:

>ANSI_NULLS statements that occur within the stored

procedure do not affect
quote:

>the functionality of the stored procedure.
>
>"shiggins_dev" <shiggins_dev@.yahoo.com> wrote in message
>news:008b01c3d61d$e358d030$a601280a@.phx.gbl...
>
>.
>
|||First, it is NOT the server / database setting - it is the setting in effect
when you create / alter the proc. The best way to do this is via QA where
you EXPLICITLY set the options needed. Using EM is an easy way to create
obscure problems since you can't be certain as to what options are in effect
at any given point in time. Learn to do everything via QA and you will be
better off in the long term.
Secondly, ANSI_WARNINGS is not a setting "saved" with the procedure. The
setting is evaluated when the proc is executed, so your connection must be
setting this off. Often this is set off because developers don't want to
deal with the "null value eliminated from aggregate" message. However, you
can set this within the procedure AFAIK.
As an aside, you can use profiler to watch the exact commands used by EM.
Give it a try - and be amazed.
"shiggins_dev" <shiggins_dev@.yahoo.com> wrote in message
news:025a01c3d62a$f3e04e80$a501280a@.phx.gbl...[QUOTE]
> I suffer from premature submission...anyway.
> Thanks Scott. I made sure the Server and the DB both have
> ANSI_NULLS AND ANSI_WARNINGS set to on then I recreated my
> proc and I still get the same error. Any other ideas?
> Thanks.
> setting value from
> Whenever the stored
> ANSI_NULLS is
> When invoked inside
> changed.
> QUOTED_IDENTIFIER and SET
> These original
> Therefore, any
> ANSI_NULLS are
> QUOTED_IDENTIFIER and SET
> procedure do not affect|||Scott,
Thanks so much for your patience. I always created all my
procs in EM not realizing that I should be doing it in
QA. Thanks for the tip. Still having the same problem
though, here's what I've done.
I started the Profiler and created the proc in QA like so:
Set ANSI_NULLS ON
Set ANSI_WARNINGS ON
Go
CREATE PROCEDURE osp_excelimport
@.filename varchar(1000)
AS
declare @.sqlst as nvarchar(1000)
set @.sqlst = 'drop table Mailing'
--exec sp_sqlexec @.sqlst
set @.sqlst = 'select * into Mailing from OPENROWSET
(''Microsoft.Jet.OLEDB.4.0'',
''Excel
8.0;Database='+@.filename+''', [Data$])'
exec sp_sqlexec @.sqlst
GO
I then ran this and called the proc and got the same error
message. I didn't see anything in the Profiler that
looked funny. Here is the output:
28 13 Set ANSI_NULLS ON Set ANSI_WARNINGS ON
NULL 72 SQL Query Analyzer sa 75
NULL 2004-01-08 14:57:43.653 NULL NULL
NULL
29 40 Set ANSI_NULLS ON NULL 72
SQL Query Analyzer sa 75 NULL
2004-01-08 14:57:43.653 NULL NULL NULL
30 41 Set ANSI_NULLS ON NULL 72
SQL Query Analyzer sa 75 0
2004-01-08 14:57:43.653 0 0 0
31 40 Set ANSI_WARNINGS ON NULL 72
SQL Query Analyzer sa 75 NULL
2004-01-08 14:57:43.670 NULL NULL NULL
32 41 Set ANSI_WARNINGS ON NULL 72
SQL Query Analyzer sa 75 0
2004-01-08 14:57:43.670 0 0 0
33 12 Set ANSI_NULLS ON Set ANSI_WARNINGS ON
NULL 72 SQL Query Analyzer sa 75
16 2004-01-08 14:57:43.653 0 0 0
34 13 CREATE PROCEDURE osp_excelimport
@.filename varchar(1000) AS declare @.sqlst as nvarchar
(1000) set @.sqlst = 'drop table nashMainMailing' --
exec sp_sqlexec @.sqlst set @.sqlst = 'select * into
nashMainMailing from OPENROWSET(''Microsoft.Je NULL 72
SQL Query Analyzer sa 75 NULL
2004-01-08 14:57:43.700 NULL NULL NULL
35 50 NULL NULL 72 SQL Query Analyzer
sa 75 NULL 2004-01-08 14:57:43.700
NULL NULL NULL
36 46 NULL NULL 72 SQL Query Analyzer
sa 75 NULL 2004-01-08 14:57:43.700
NULL NULL NULL
37 50 NULL NULL 72 SQL Query Analyzer
sa 75 0 2004-01-08 14:57:43.700
NULL NULL NULL
38 50 NULL NULL 72 SQL Query Analyzer
sa 75 NULL 2004-01-08 14:57:43.700
NULL NULL NULL
39 50 NULL NULL 72 SQL Query Analyzer
sa 75 0 2004-01-08 14:57:43.700
NULL NULL NULL
40 50 NULL NULL 72 SQL Query Analyzer
sa 75 NULL 2004-01-08 14:57:43.700
NULL NULL NULL
41 50 NULL NULL 72 SQL Query Analyzer
sa 75 0 2004-01-08 14:57:43.700
NULL NULL NULL
42 50 NULL NULL 72 SQL Query Analyzer
sa 75 NULL 2004-01-08 14:57:43.700
NULL NULL NULL
43 50 NULL NULL 72 SQL Query Analyzer
sa 75 0 2004-01-08 14:57:43.700
NULL NULL NULL
44 12 CREATE PROCEDURE osp_excelimport
@.filename varchar(1000) AS declare @.sqlst as nvarchar
(1000) set @.sqlst = 'drop table nashMainMailing' --
exec sp_sqlexec @.sqlst set @.sqlst = 'select * into
nashMainMailing from OPENROWSET(''Microsoft.Je NULL 72
SQL Query Analyzer sa 75 0
2004-01-08 14:57:43.700 21 0 0
45 13 exec
osp_excelimport " E:\inetpub\wwwroot\JoEllenNash\Text\2004
18
113035.xls" NULL 72 SQL Query Analyzer sa
59 NULL 2004-01-08 14:57:54.640 NULL
NULL NULL
46 40 exec
osp_excelimport " E:\inetpub\wwwroot\JoEllenNash\Text\2004
18
113035.xls" NULL 72 SQL Query Analyzer sa
59 NULL 2004-01-08 14:57:54.640 NULL
NULL NULL
47 12 exec
osp_excelimport " E:\inetpub\wwwroot\JoEllenNash\Text\2004
18
113035.xls" NULL 72 SQL Query Analyzer sa
59 0 2004-01-08 14:57:54.640 20 0
0
48 5 NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL
I should also probably tell you that I am running this
from QA on a different server than where the db is. In
addition, when I run the two statments ("drop table.. and
OPENROWSET...) in one QA window it runs fine. I have no
idea but I will keep searching.
Thanks again for all you help.
quote:

>--Original Message--
>First, it is NOT the server / database setting - it is

the setting in effect
quote:

>when you create / alter the proc. The best way to do

this is via QA where
quote:

>you EXPLICITLY set the options needed. Using EM is an

easy way to create
quote:

>obscure problems since you can't be certain as to what

options are in effect
quote:

>at any given point in time. Learn to do everything via

QA and you will be
quote:

>better off in the long term.
>Secondly, ANSI_WARNINGS is not a setting "saved" with the

procedure. The
quote:

>setting is evaluated when the proc is executed, so your

connection must be
quote:

>setting this off. Often this is set off because

developers don't want to
quote:

>deal with the "null value eliminated from aggregate"

message. However, you
quote:

>can set this within the procedure AFAIK.
>As an aside, you can use profiler to watch the exact

commands used by EM.
quote:

>Give it a try - and be amazed.
>"shiggins_dev" <shiggins_dev@.yahoo.com> wrote in message
>news:025a01c3d62a$f3e04e80$a501280a@.phx.gbl...
have[QUOTE]
my[QUOTE]
ANSI_NULLS[QUOTE]
not[QUOTE]
altered.[QUOTE]
executed.[QUOTE]
SET[QUOTE]
message[QUOTE]
message "Heterogeneous[QUOTE]
options[QUOTE]
reissue[QUOTE]
don't[QUOTE]
>
>.
>