Showing posts with label system. Show all posts
Showing posts with label system. Show all posts

Monday, March 26, 2012

Problem in Converting Task to DataPumpTask2

Hai All,

I tried to convert a Task to DataPumpTask2.

But i got an Error

An unhandled exception of type 'System.InvalidCastException' occurred

QueryInterface for interface DTS.CustomTask failed

I installed SP3 for SqlServer in my Desktop and in the Server itself.

But i faced the same problem again.

If anyone have idea please enligten me .

Thanx,

Karthik.A

Hai All,

I found the Solution.

What we have to do is,Just install the SP3 for desktop SQL2KDeskSP3.exe in ur Machine.

While installation, it asks for "sa" Password.

Just open the setup.ini in the Extracted folder sql2ksp3/MSDE/setup.ini

and add PWD sa = <Password> below the [options].

then it starts installation.Once it's completed .

Compile ur code.it runs successfully.

Thanx,

Karthik.A

Friday, March 23, 2012

problem in accessing report manager and server

hi,

i installed RS 2005 on windows XP with local system account,report manager does not access.it gives

The page cannot be displayed

HTTP 500 - Internal server error
Internet Explorer

although reportmanager and reportserver directory is available in its default location.

and also when i clicked on any report on report server it gives

An internal error occurred on the report server. See the error log for more details. (rsInternalError) Get Online Help

Requested registry access is not allowed.

i am using my account having admin privlge

please help me.....

Amit,

Could you, please, take a look at the log files for the windows service and for the web service and let me know what errors you find there?

The RS log files are located here:

%Program Files%\Microsoft SQL Server\MSSQL.X\Reporting Services\LogFiles

The log files for the RS windows service look like this: ReportServerService_(timestamp).log and the log files for the RS web service look like this: ReportServer_(timestamp).log.

Mihaela

problem in accessing report manager and server

hi,

i installed RS 2005 on windows XP with local system account,report manager does not access.it gives

The page cannot be displayed

HTTP 500 - Internal server error
Internet Explorer

although reportmanager and reportserver directory is available in its default location.

and also when i clicked on any report on report server it gives

An internal error occurred on the report server. See the error log for more details. (rsInternalError) Get Online Help

Requested registry access is not allowed.

i am using my account having admin privlge

please help me.....

Amit,

Could you, please, take a look at the log files for the windows service and for the web service and let me know what errors you find there?

The RS log files are located here:

%Program Files%\Microsoft SQL Server\MSSQL.X\Reporting Services\LogFiles

The log files for the RS windows service look like this: ReportServerService_(timestamp).log and the log files for the RS web service look like this: ReportServer_(timestamp).log.

Mihaela

Wednesday, March 21, 2012

Problem getting contacts from Exchange

When I attempt to use ADO to get data from any "Contacts" folder I always get...

System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="System.Data"
StackTrace:
at System.Data.Common.UnsafeNativeMethods.ICommandText.Execute(IntPtr pUnkOuter, Guid& riid, tagDBPARAMS pDBParams, IntPtr& pcRowsAffected, Object& ppRowset)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at WinAppExchange.Form1.button1_Click(Object sender, EventArgs e) in C:\Projects\CodeReviewHelper\WinAppExchange\WinAppExchange\Form1.cs:line 31
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WinAppExchange.Program.Main() in C:\Projects\CodeReviewHelper\WinAppExchange\WinAppExchange\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

string connect = @."Provider=Microsoft.Jet.OLEDB.4.0;Exchange 4.0;MAPILEVEL=Public Folders|All Public\Our Contact List;DATABASE=C:\\Temp\\;";

OleDbConnection connection = new OleDbConnection(connect);

connection.Open();

OleDbCommand command = new OleDbCommand("Select * from [Staff]",connection);

using (OleDbDataReader dataReader = command.ExecuteReader(CommandBehavior.CloseConnection)) // EXCEPTION HERE

{

while (dataReader.Read())

{

System.Diagnostics.Debug.WriteLine(dataReader[0]);

}

}

I've tried the same code against my local stores and I get the same result. However, it works fine for every other folder type, Tasks, notes, inbox, etc. Any ideas?

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=168193&SiteID=1

HTH

Monday, March 12, 2012

problem dynamicly populating a checkboxlist from a query

I have the follow, i get the right amout of checkboxes but they all have the same value(System.Data.Common.DbDataRecord)

Dim objconnAsNew SqlConnection(connstring_MPR)Dim objcmdAs SqlCommand =New SqlCommand("SELECT [Parts Master Table].COMMD_CODE as comcode FROM [Parts Master Table] INNER JOIN [Warehouse balance table] ON [Parts Master Table].PART_NUMBER = [Warehouse balance table].PART INNER JOIN POREPORT ON [Parts Master Table].PART_NUMBER = POREPORT.[Part Number] INNER JOIN [DEMAND TABLE] ON [Parts Master Table].PART_NUMBER = [DEMAND TABLE].PART WHERE POREPORT.[PO Bal] > 0 OR [DEMAND TABLE].QTY > 0 or [Warehouse balance table].ONHAND > 0 and [Parts Master Table].M_B = 1 AND [Warehouse balance table].WHSE = 'sgr' AND ([Parts Master Table].FAMILY NOT LIKE 'lam%' or [Parts Master Table].FAMILY NOT IN ('ULTCH', 'REMOT', 'MKSIN')) GROUP BY [Parts Master Table].COMMD_CODE ORDER BY [Parts Master Table].COMMD_CODE", objconn)

objconn.Open()

chkComCode.DataSource = objcmd.ExecuteReader(CommandBehavior.CloseConnection)

chkComCode.DataBind()

objconn.Close()

First thing is, run your query in Query Analyzer and see it returns the same value(comcode) for each row. And secondly set DataText field and DataValue field. [even though it is not necessary for your query]

chkComCode.DataTextField="comcode"
chkComCode.DataValueField="comcode"

|||

yep i had to go into source and set the textfield/value field to = comcode

Friday, March 9, 2012

Problem deploying reports

Hi,

I have an application that involves 3 components one of which is
Reports.
My system's configuration:
SQL 2000 - Default instance
SQL 2005 - Named instance (Instance1).

I provide the user with an option of selecting the SQL Server instance.
If the user chooses Instance1, then I need to deply the reports in SQL
2005.
The exceptions encountered during installation are logged in the Event
log.
When I do the installation for the in a machine, I always
get the following error in the event log:
Could not connect to the Report Server Database
http://<MachineName>/ReportingServices.asmx.
I tried giving the rs.exe options from commandline. I got an error like:

Error in DetermineReportUrlSecurity().

I don't have the exact error with me now.

Note that I do not get this error when I do the installation in a
machine where both default and named instances are SQL 2005.

Can anyone tell me why this happens?

Thanks,

Sandhya

Are you installing RS2005 on the same machine as RS 2000? If so you should be prompted to do a files only install, is that the case? If it is then I am not sure when you are seeing this error. During configuration? If you could provide the error message and a better description of exactly what you are doing, perhaps I can offer some help.|||

Hi,

I am deploying my reports during the time of installation of my application i.e., throwugh an msi. I deploy the reports using rs.exe command and any error encountered would be logged in event log.

While installing SQL 2005. I selected the option 'Install and configure' for Reporting Services component. I also verified that I am able to browse to the Reports page. So there is no problem with the configuration. Someone had a similar problem which I saw in another forum. There a solution was given as to disable the firewall/create exceptions for report server. But in my system the firewall is already disabled.

I am deploying my reports from the installer by giving the rs.exe command wherein I get the following error:
Could not connect to the Report Server Database
http://<MachineName>/ReportingServices.asmx.

I tried giving the rs.exe from the command line with -t parameter to trace the error.
Folowing is the exact error that I am getting:
Microsoft.ReportingServices.ScriptHost.ScriptHost.DetermineServerUrlSecuri
ty()
at Microsoft.ReportingServices.ScriptHost.ScriptHost.InstanceMain()
at Microsoft.ReportingServices.BaseCmdLine.CommandLineMain(String[] args,
BaseCmdLine instance)

Why do I get this error?


Thanks,
Sandhya

|||

You need to connect to http://machinename/ReportServer/ReportingServices.asmx.

I hope this help.s

|||Hi,
I am connecting to http://machinename/ReportServer/ReportingServices.asmx.
Still I get the error. Any clues as to why I face this problem?
Thanks,
Sandhya|||According to the error the report server does not exist. Does the report server come up if you browse to http://machinename/reportserver? Does http://machinename/reports work?|||

Hi,

For Yukon, the default configuration for the Report page would be:

Default instance - http://<machinename>/reports

Named Instance - http://<machinename>/reports$<InstanceName>

In my case, I have Yukon in the named instance(Instance1). Hence I need to connect to http://<machinename>/reports$Instance1 and I verified that I am able to browse to this page. I get the Reports homepage.

When I browse to http://machinename/reportserver$Instance1, I get the following displayed in the page:

chnshl13423/ReportServer$Instance1 - /



Microsoft SQL Server Reporting Services Version 9.00.1399.00

So what might be the problem?

Thanks,

Sandhya

|||you should pass in -s http://machinename/reportserver$Instance1 to rs.exe.|||

Hi,

I am already giving the following:

rs.exe -i "C:\Pr\DCMReports For Yukon\DeploymentScript\PublishDCMReports.rss" -s "http://chnshl13423/reportserver$Instance1" -v parentFolder="DCM Reports For Yukon" -v reportLocation="C:\Pr\DCMReports For Yukon\DeploymentScript\PublishDCMReports.rss" -v serverName="chnshl13423\Instance1" -v databaseName="DCMSolution"

Thanks,

Sandhya

|||Any suggestions?|||

Hmm, It looks like you are doing everything that you should be. All the script host does at this point is call the soap method ListSecureMethods, using the ReportService2005.asmx endpoint. Your command looks correct and the server is up and running. I really don't know what would be causing this error.

The only thing I can think of is if the user you are running rs.exe as can not be authenticated with RS or RS is setup to use forms or basic auth. You could try using a different user, or if you are using basic auth, pass in the username and password options.

Problem deploying reports

Hi,

I have an application that involves 3 components one of which is
Reports.
My system's configuration:
SQL 2000 - Default instance
SQL 2005 - Named instance (Instance1).

I provide the user with an option of selecting the SQL Server instance.
If the user chooses Instance1, then I need to deply the reports in SQL
2005.
The exceptions encountered during installation are logged in the Event
log.
When I do the installation for the in a machine, I always
get the following error in the event log:
Could not connect to the Report Server Database
http://<MachineName>/ReportingServices.asmx.
I tried giving the rs.exe options from commandline. I got an error like:

Error in DetermineReportUrlSecurity().

I don't have the exact error with me now.

Note that I do not get this error when I do the installation in a
machine where both default and named instances are SQL 2005.

Can anyone tell me why this happens?

Thanks,

Sandhya

Are you installing RS2005 on the same machine as RS 2000? If so you should be prompted to do a files only install, is that the case? If it is then I am not sure when you are seeing this error. During configuration? If you could provide the error message and a better description of exactly what you are doing, perhaps I can offer some help.|||

Hi,

I am deploying my reports during the time of installation of my application i.e., throwugh an msi. I deploy the reports using rs.exe command and any error encountered would be logged in event log.

While installing SQL 2005. I selected the option 'Install and configure' for Reporting Services component. I also verified that I am able to browse to the Reports page. So there is no problem with the configuration. Someone had a similar problem which I saw in another forum. There a solution was given as to disable the firewall/create exceptions for report server. But in my system the firewall is already disabled.

I am deploying my reports from the installer by giving the rs.exe command wherein I get the following error:
Could not connect to the Report Server Database
http://<MachineName>/ReportingServices.asmx.

I tried giving the rs.exe from the command line with -t parameter to trace the error.
Folowing is the exact error that I am getting:
Microsoft.ReportingServices.ScriptHost.ScriptHost.DetermineServerUrlSecuri
ty()
at Microsoft.ReportingServices.ScriptHost.ScriptHost.InstanceMain()
at Microsoft.ReportingServices.BaseCmdLine.CommandLineMain(String[] args,
BaseCmdLine instance)

Why do I get this error?


Thanks,
Sandhya

|||

You need to connect to http://machinename/ReportServer/ReportingServices.asmx.

I hope this help.s

|||Hi,
I am connecting to http://machinename/ReportServer/ReportingServices.asmx.
Still I get the error. Any clues as to why I face this problem?
Thanks,
Sandhya|||According to the error the report server does not exist. Does the report server come up if you browse to http://machinename/reportserver? Does http://machinename/reports work?|||

Hi,

For Yukon, the default configuration for the Report page would be:

Default instance - http://<machinename>/reports

Named Instance - http://<machinename>/reports$<InstanceName>

In my case, I have Yukon in the named instance(Instance1). Hence I need to connect to http://<machinename>/reports$Instance1 and I verified that I am able to browse to this page. I get the Reports homepage.

When I browse to http://machinename/reportserver$Instance1, I get the following displayed in the page:

chnshl13423/ReportServer$Instance1 - /



Microsoft SQL Server Reporting Services Version 9.00.1399.00

So what might be the problem?

Thanks,

Sandhya

|||you should pass in -s http://machinename/reportserver$Instance1 to rs.exe.|||

Hi,

I am already giving the following:

rs.exe -i "C:\Pr\DCMReports For Yukon\DeploymentScript\PublishDCMReports.rss" -s "http://chnshl13423/reportserver$Instance1" -v parentFolder="DCM Reports For Yukon" -v reportLocation="C:\Pr\DCMReports For Yukon\DeploymentScript\PublishDCMReports.rss" -v serverName="chnshl13423\Instance1" -v databaseName="DCMSolution"

Thanks,

Sandhya

|||Any suggestions?|||

Hmm, It looks like you are doing everything that you should be. All the script host does at this point is call the soap method ListSecureMethods, using the ReportService2005.asmx endpoint. Your command looks correct and the server is up and running. I really don't know what would be causing this error.

The only thing I can think of is if the user you are running rs.exe as can not be authenticated with RS or RS is setup to use forms or basic auth. You could try using a different user, or if you are using basic auth, pass in the username and password options.

Problem Deleteing Records with Indexed Computed Column

Got the following error when trying to delete records from a table that
contained and Indexed Computed column.
"System.Data.SqlClient.SqlError: DELETE failed because the following SET
options have incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFIER, ARITHABORT'.
This is similar to the problem in KB Article 816780
The issue the KB article is referring to was with some shipping code. The
issue you're seeing is because you need to set the SET options correctly
before issuing the delete. From BOL 'SET' topic:
When creating and manipulating indexes on computed columns or indexed views,
the SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER,
ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option
NUMERIC_ROUNDABORT must be set to OFF.
Hope this helps.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:ED599EDB-3612-485E-8839-1B282A43C186@.microsoft.com...
> Got the following error when trying to delete records from a table that
> contained and Indexed Computed column.
> "System.Data.SqlClient.SqlError: DELETE failed because the following SET
> options have incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFIER,
ARITHABORT'.
> This is similar to the problem in KB Article 816780
|||Ok, then explain why when the index is removed the problem goes away?
|||As you don't include the message you're replying to I can't tell whether
you're replying to my reply. Here's what I previously posted that will
explain why the problem goes away if you remove an index over a computed
column:
<begin>
The issue the KB article is referring to was with some shipping code. The
issue you're seeing is because you need to set the SET options correctly
before issuing the delete. From BOL 'SET' topic:
When creating and manipulating indexes on computed columns or indexed views,
the SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER,
ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option
NUMERIC_ROUNDABORT must be set to OFF.
Hope this helps.
<end>
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:74948FCE-9171-4F10-B596-0A366AC6805C@.microsoft.com...
> Ok, then explain why when the index is removed the problem goes away?
>
|||"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:74948FCE-9171-4F10-B596-0A366AC6805C@.microsoft.com...
> Ok, then explain why when the index is removed the problem goes away?
>
An index on a computed column has all the same restrictions as an indexed
view.
Think of it this way. All sessions connecting to your database should have
these options:
ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER,
ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option
NUMERIC_ROUNDABORT must be set to OFF.
If they don't then some features of the database will be unavailable, and
they may not be able to change data.
David
|||The restriction for the ANSI-COMPLIANT SET OPTIONS is only when creating
Indexes on Computed Columns and Views. If you never create these indexes,
then clients are not REQUIRED to connect using the set options; however, it
is recommended that clients ALWAYS connect with these options set and then
modify individual statements or batches as required regardless if the
extended functionality is used.
Sincerely,
Anthony Thomas

"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:74948FCE-9171-4F10-B596-0A366AC6805C@.microsoft.com...
Ok, then explain why when the index is removed the problem goes away?

Problem Deleteing Records with Indexed Computed Column

Got the following error when trying to delete records from a table that
contained and Indexed Computed column.
"System.Data.SqlClient.SqlError: DELETE failed because the following SET
options have incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFIER, ARITHABORT
'.
This is similar to the problem in KB Article 816780The issue the KB article is referring to was with some shipping code. The
issue you're seeing is because you need to set the SET options correctly
before issuing the delete. From BOL 'SET' topic:
When creating and manipulating indexes on computed columns or indexed views,
the SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER,
ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option
NUMERIC_ROUNDABORT must be set to OFF.
Hope this helps.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:ED599EDB-3612-485E-8839-1B282A43C186@.microsoft.com...
> Got the following error when trying to delete records from a table that
> contained and Indexed Computed column.
> "System.Data.SqlClient.SqlError: DELETE failed because the following SET
> options have incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFIER,
ARITHABORT'.
> This is similar to the problem in KB Article 816780|||Ok, then explain why when the index is removed the problem goes away?|||As you don't include the message you're replying to I can't tell whether
you're replying to my reply. Here's what I previously posted that will
explain why the problem goes away if you remove an index over a computed
column:
<begin>
The issue the KB article is referring to was with some shipping code. The
issue you're seeing is because you need to set the SET options correctly
before issuing the delete. From BOL 'SET' topic:
When creating and manipulating indexes on computed columns or indexed views,
the SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER,
ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option
NUMERIC_ROUNDABORT must be set to OFF.
Hope this helps.
<end>
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:74948FCE-9171-4F10-B596-0A366AC6805C@.microsoft.com...
> Ok, then explain why when the index is removed the problem goes away?
>|||"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:74948FCE-9171-4F10-B596-0A366AC6805C@.microsoft.com...
> Ok, then explain why when the index is removed the problem goes away?
>
An index on a computed column has all the same restrictions as an indexed
view.
Think of it this way. All sessions connecting to your database should have
these options:
ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER,
ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option
NUMERIC_ROUNDABORT must be set to OFF.
If they don't then some features of the database will be unavailable, and
they may not be able to change data.
David|||The restriction for the ANSI-COMPLIANT SET OPTIONS is only when creating
Indexes on Computed Columns and Views. If you never create these indexes,
then clients are not REQUIRED to connect using the set options; however, it
is recommended that clients ALWAYS connect with these options set and then
modify individual statements or batches as required regardless if the
extended functionality is used.
Sincerely,
Anthony Thomas
"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:74948FCE-9171-4F10-B596-0A366AC6805C@.microsoft.com...
Ok, then explain why when the index is removed the problem goes away?

Problem Deleteing Records with Indexed Computed Column

Got the following error when trying to delete records from a table that
contained and Indexed Computed column.
"System.Data.SqlClient.SqlError: DELETE failed because the following SET
options have incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFIER, ARITHABORT'.
This is similar to the problem in KB Article 816780The issue the KB article is referring to was with some shipping code. The
issue you're seeing is because you need to set the SET options correctly
before issuing the delete. From BOL 'SET' topic:
When creating and manipulating indexes on computed columns or indexed views,
the SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER,
ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option
NUMERIC_ROUNDABORT must be set to OFF.
Hope this helps.
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:ED599EDB-3612-485E-8839-1B282A43C186@.microsoft.com...
> Got the following error when trying to delete records from a table that
> contained and Indexed Computed column.
> "System.Data.SqlClient.SqlError: DELETE failed because the following SET
> options have incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFIER,
ARITHABORT'.
> This is similar to the problem in KB Article 816780|||Ok, then explain why when the index is removed the problem goes away?|||As you don't include the message you're replying to I can't tell whether
you're replying to my reply. Here's what I previously posted that will
explain why the problem goes away if you remove an index over a computed
column:
<begin>
The issue the KB article is referring to was with some shipping code. The
issue you're seeing is because you need to set the SET options correctly
before issuing the delete. From BOL 'SET' topic:
When creating and manipulating indexes on computed columns or indexed views,
the SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER,
ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option
NUMERIC_ROUNDABORT must be set to OFF.
Hope this helps.
<end>
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:74948FCE-9171-4F10-B596-0A366AC6805C@.microsoft.com...
> Ok, then explain why when the index is removed the problem goes away?
>|||"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:74948FCE-9171-4F10-B596-0A366AC6805C@.microsoft.com...
> Ok, then explain why when the index is removed the problem goes away?
>
An index on a computed column has all the same restrictions as an indexed
view.
Think of it this way. All sessions connecting to your database should have
these options:
ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER,
ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option
NUMERIC_ROUNDABORT must be set to OFF.
If they don't then some features of the database will be unavailable, and
they may not be able to change data.
David|||The restriction for the ANSI-COMPLIANT SET OPTIONS is only when creating
Indexes on Computed Columns and Views. If you never create these indexes,
then clients are not REQUIRED to connect using the set options; however, it
is recommended that clients ALWAYS connect with these options set and then
modify individual statements or batches as required regardless if the
extended functionality is used.
Sincerely,
Anthony Thomas
"Lee" <Lee@.discussions.microsoft.com> wrote in message
news:74948FCE-9171-4F10-B596-0A366AC6805C@.microsoft.com...
Ok, then explain why when the index is removed the problem goes away?

Saturday, February 25, 2012

Problem creating a secondary datafile on drive E:\

Hi. I am a student, taking a class on MS SQL SERVER 2000 system admin and
programming. I created a database, tsqldb, on C:\, where the ms sql server
files reside. Now, I used the alter database command to add a secondary
datafile, tsqldb_data2 to drive E:\ that I've created and that is where I
want to put this secondary datafile file, E:\. the alter database command
goes like this:
alter database tsqldb
add file
( name = tsqldb_data2,
filename = 'E:\tsqldb_data2.ndf',
size = 50mb,
maxsize = 150mb,
filegrowth = 25%
)
and this is the error I get:
Server: Msg 5123, Level 16, State 1, Line 1
CREATE FILE encountered operating system error 5(Access is denied.) while
attempting to open or create the physical file 'E:\tsqldb_data2.ndf'.
Server: Msg 5009, Level 16, State 1, Line 1
ALTER DATABASE failed. Some disk names listed in the statement were not
found. Check that the names exist and are spelled correctly before rerunning
the statement.
Extending database by 50.00 MB on disk 'tsqldb_data2'.
Can someone help me? Thanks.
DominickCheck whether the service account that runs the SQL Server instance has the
permission to create files in E:\.
Linchi
"Dominick D." wrote:
> Hi. I am a student, taking a class on MS SQL SERVER 2000 system admin and
> programming. I created a database, tsqldb, on C:\, where the ms sql server
> files reside. Now, I used the alter database command to add a secondary
> datafile, tsqldb_data2 to drive E:\ that I've created and that is where I
> want to put this secondary datafile file, E:\. the alter database command
> goes like this:
> alter database tsqldb
> add file
> ( name = tsqldb_data2,
> filename = 'E:\tsqldb_data2.ndf',
> size = 50mb,
> maxsize = 150mb,
> filegrowth = 25%
> )
> and this is the error I get:
> Server: Msg 5123, Level 16, State 1, Line 1
> CREATE FILE encountered operating system error 5(Access is denied.) while
> attempting to open or create the physical file 'E:\tsqldb_data2.ndf'.
> Server: Msg 5009, Level 16, State 1, Line 1
> ALTER DATABASE failed. Some disk names listed in the statement were not
> found. Check that the names exist and are spelled correctly before rerunning
> the statement.
> Extending database by 50.00 MB on disk 'tsqldb_data2'.
> Can someone help me? Thanks.
> Dominick|||How do I check that? I"m a newbie to SQL, file permissions, so I'd appreciate
your assistance. Thanks.
"Linchi Shea" wrote:
> Check whether the service account that runs the SQL Server instance has the
> permission to create files in E:\.
> Linchi
> "Dominick D." wrote:
> > Hi. I am a student, taking a class on MS SQL SERVER 2000 system admin and
> > programming. I created a database, tsqldb, on C:\, where the ms sql server
> > files reside. Now, I used the alter database command to add a secondary
> > datafile, tsqldb_data2 to drive E:\ that I've created and that is where I
> > want to put this secondary datafile file, E:\. the alter database command
> > goes like this:
> >
> > alter database tsqldb
> > add file
> > ( name = tsqldb_data2,
> > filename = 'E:\tsqldb_data2.ndf',
> > size = 50mb,
> > maxsize = 150mb,
> > filegrowth = 25%
> > )
> >
> > and this is the error I get:
> >
> > Server: Msg 5123, Level 16, State 1, Line 1
> > CREATE FILE encountered operating system error 5(Access is denied.) while
> > attempting to open or create the physical file 'E:\tsqldb_data2.ndf'.
> > Server: Msg 5009, Level 16, State 1, Line 1
> >
> > ALTER DATABASE failed. Some disk names listed in the statement were not
> > found. Check that the names exist and are spelled correctly before rerunning
> > the statement.
> > Extending database by 50.00 MB on disk 'tsqldb_data2'.
> >
> > Can someone help me? Thanks.
> >
> > Dominick|||Using Windows Explorer, right click on the drive or folder and bring up its
properties. It's under the Security tab.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Dominick D." <DominickD@.discussions.microsoft.com> wrote in message
news:BE503C3C-EF2C-47DF-A91B-41C3E95959CB@.microsoft.com...
How do I check that? I"m a newbie to SQL, file permissions, so I'd
appreciate
your assistance. Thanks.
"Linchi Shea" wrote:
> Check whether the service account that runs the SQL Server instance has
> the
> permission to create files in E:\.
> Linchi
> "Dominick D." wrote:
> > Hi. I am a student, taking a class on MS SQL SERVER 2000 system admin
> > and
> > programming. I created a database, tsqldb, on C:\, where the ms sql
> > server
> > files reside. Now, I used the alter database command to add a secondary
> > datafile, tsqldb_data2 to drive E:\ that I've created and that is where
> > I
> > want to put this secondary datafile file, E:\. the alter database
> > command
> > goes like this:
> >
> > alter database tsqldb
> > add file
> > ( name = tsqldb_data2,
> > filename = 'E:\tsqldb_data2.ndf',
> > size = 50mb,
> > maxsize = 150mb,
> > filegrowth = 25%
> > )
> >
> > and this is the error I get:
> >
> > Server: Msg 5123, Level 16, State 1, Line 1
> > CREATE FILE encountered operating system error 5(Access is denied.)
> > while
> > attempting to open or create the physical file 'E:\tsqldb_data2.ndf'.
> > Server: Msg 5009, Level 16, State 1, Line 1
> >
> > ALTER DATABASE failed. Some disk names listed in the statement were not
> > found. Check that the names exist and are spelled correctly before
> > rerunning
> > the statement.
> > Extending database by 50.00 MB on disk 'tsqldb_data2'.
> >
> > Can someone help me? Thanks.
> >
> > Dominick|||Talk to the person who administers the machine in question. They should be able to check what
service account the service is using and see whether that account has permissions to create files in
the folder in question.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Dominick D." <DominickD@.discussions.microsoft.com> wrote in message
news:BE503C3C-EF2C-47DF-A91B-41C3E95959CB@.microsoft.com...
> How do I check that? I"m a newbie to SQL, file permissions, so I'd appreciate
> your assistance. Thanks.
>
> "Linchi Shea" wrote:
>> Check whether the service account that runs the SQL Server instance has the
>> permission to create files in E:\.
>> Linchi
>> "Dominick D." wrote:
>> > Hi. I am a student, taking a class on MS SQL SERVER 2000 system admin and
>> > programming. I created a database, tsqldb, on C:\, where the ms sql server
>> > files reside. Now, I used the alter database command to add a secondary
>> > datafile, tsqldb_data2 to drive E:\ that I've created and that is where I
>> > want to put this secondary datafile file, E:\. the alter database command
>> > goes like this:
>> >
>> > alter database tsqldb
>> > add file
>> > ( name = tsqldb_data2,
>> > filename = 'E:\tsqldb_data2.ndf',
>> > size = 50mb,
>> > maxsize = 150mb,
>> > filegrowth = 25%
>> > )
>> >
>> > and this is the error I get:
>> >
>> > Server: Msg 5123, Level 16, State 1, Line 1
>> > CREATE FILE encountered operating system error 5(Access is denied.) while
>> > attempting to open or create the physical file 'E:\tsqldb_data2.ndf'.
>> > Server: Msg 5009, Level 16, State 1, Line 1
>> >
>> > ALTER DATABASE failed. Some disk names listed in the statement were not
>> > found. Check that the names exist and are spelled correctly before rerunning
>> > the statement.
>> > Extending database by 50.00 MB on disk 'tsqldb_data2'.
>> >
>> > Can someone help me? Thanks.
>> >
>> > Dominick|||OK, I managed to do a little research on E:\ and I included the service
account that I set up to have full control over E:\ and it did the trick.
"Tom Moreau" wrote:
> Using Windows Explorer, right click on the drive or folder and bring up its
> properties. It's under the Security tab.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> ..
> "Dominick D." <DominickD@.discussions.microsoft.com> wrote in message
> news:BE503C3C-EF2C-47DF-A91B-41C3E95959CB@.microsoft.com...
> How do I check that? I"m a newbie to SQL, file permissions, so I'd
> appreciate
> your assistance. Thanks.
>
> "Linchi Shea" wrote:
> > Check whether the service account that runs the SQL Server instance has
> > the
> > permission to create files in E:\.
> >
> > Linchi
> >
> > "Dominick D." wrote:
> >
> > > Hi. I am a student, taking a class on MS SQL SERVER 2000 system admin
> > > and
> > > programming. I created a database, tsqldb, on C:\, where the ms sql
> > > server
> > > files reside. Now, I used the alter database command to add a secondary
> > > datafile, tsqldb_data2 to drive E:\ that I've created and that is where
> > > I
> > > want to put this secondary datafile file, E:\. the alter database
> > > command
> > > goes like this:
> > >
> > > alter database tsqldb
> > > add file
> > > ( name = tsqldb_data2,
> > > filename = 'E:\tsqldb_data2.ndf',
> > > size = 50mb,
> > > maxsize = 150mb,
> > > filegrowth = 25%
> > > )
> > >
> > > and this is the error I get:
> > >
> > > Server: Msg 5123, Level 16, State 1, Line 1
> > > CREATE FILE encountered operating system error 5(Access is denied.)
> > > while
> > > attempting to open or create the physical file 'E:\tsqldb_data2.ndf'.
> > > Server: Msg 5009, Level 16, State 1, Line 1
> > >
> > > ALTER DATABASE failed. Some disk names listed in the statement were not
> > > found. Check that the names exist and are spelled correctly before
> > > rerunning
> > > the statement.
> > > Extending database by 50.00 MB on disk 'tsqldb_data2'.
> > >
> > > Can someone help me? Thanks.
> > >
> > > Dominick
>

Problem creating a secondary datafile on drive E:\

Hi. I am a student, taking a class on MS SQL SERVER 2000 system admin and
programming. I created a database, tsqldb, on C:\, where the ms sql server
files reside. Now, I used the alter database command to add a secondary
datafile, tsqldb_data2 to drive E:\ that I've created and that is where I
want to put this secondary datafile file, E:\. the alter database command
goes like this:
alter database tsqldb
add file
( name = tsqldb_data2,
filename = 'E:\tsqldb_data2.ndf',
size = 50mb,
maxsize = 150mb,
filegrowth = 25%
)
and this is the error I get:
Server: Msg 5123, Level 16, State 1, Line 1
CREATE FILE encountered operating system error 5(Access is denied.) while
attempting to open or create the physical file 'E:\tsqldb_data2.ndf'.
Server: Msg 5009, Level 16, State 1, Line 1
ALTER DATABASE failed. Some disk names listed in the statement were not
found. Check that the names exist and are spelled correctly before rerunning
the statement.
Extending database by 50.00 MB on disk 'tsqldb_data2'.
Can someone help me? Thanks.
DominickCheck whether the service account that runs the SQL Server instance has the
permission to create files in E:\.
Linchi
"Dominick D." wrote:

> Hi. I am a student, taking a class on MS SQL SERVER 2000 system admin and
> programming. I created a database, tsqldb, on C:\, where the ms sql server
> files reside. Now, I used the alter database command to add a secondary
> datafile, tsqldb_data2 to drive E:\ that I've created and that is where I
> want to put this secondary datafile file, E:\. the alter database command
> goes like this:
> alter database tsqldb
> add file
> ( name = tsqldb_data2,
> filename = 'E:\tsqldb_data2.ndf',
> size = 50mb,
> maxsize = 150mb,
> filegrowth = 25%
> )
> and this is the error I get:
> Server: Msg 5123, Level 16, State 1, Line 1
> CREATE FILE encountered operating system error 5(Access is denied.) while
> attempting to open or create the physical file 'E:\tsqldb_data2.ndf'.
> Server: Msg 5009, Level 16, State 1, Line 1
> ALTER DATABASE failed. Some disk names listed in the statement were not
> found. Check that the names exist and are spelled correctly before rerunni
ng
> the statement.
> Extending database by 50.00 MB on disk 'tsqldb_data2'.
> Can someone help me? Thanks.
> Dominick|||How do I check that? I"m a newbie to SQL, file permissions, so I'd appreciat
e
your assistance. Thanks.
"Linchi Shea" wrote:
[vbcol=seagreen]
> Check whether the service account that runs the SQL Server instance has th
e
> permission to create files in E:\.
> Linchi
> "Dominick D." wrote:
>|||Using Windows Explorer, right click on the drive or folder and bring up its
properties. It's under the Security tab.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Dominick D." <DominickD@.discussions.microsoft.com> wrote in message
news:BE503C3C-EF2C-47DF-A91B-41C3E95959CB@.microsoft.com...
How do I check that? I"m a newbie to SQL, file permissions, so I'd
appreciate
your assistance. Thanks.
"Linchi Shea" wrote:
[vbcol=seagreen]
> Check whether the service account that runs the SQL Server instance has
> the
> permission to create files in E:\.
> Linchi
> "Dominick D." wrote:
>|||Talk to the person who administers the machine in question. They should be a
ble to check what
service account the service is using and see whether that account has permis
sions to create files in
the folder in question.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Dominick D." <DominickD@.discussions.microsoft.com> wrote in message
news:BE503C3C-EF2C-47DF-A91B-41C3E95959CB@.microsoft.com...[vbcol=seagreen]
> How do I check that? I"m a newbie to SQL, file permissions, so I'd appreci
ate
> your assistance. Thanks.
>
> "Linchi Shea" wrote:
>|||OK, I managed to do a little research on E:\ and I included the service
account that I set up to have full control over E:\ and it did the trick.
"Tom Moreau" wrote:

> Using Windows Explorer, right click on the drive or folder and bring up it
s
> properties. It's under the Security tab.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> ..
> "Dominick D." <DominickD@.discussions.microsoft.com> wrote in message
> news:BE503C3C-EF2C-47DF-A91B-41C3E95959CB@.microsoft.com...
> How do I check that? I"m a newbie to SQL, file permissions, so I'd
> appreciate
> your assistance. Thanks.
>
> "Linchi Shea" wrote:
>
>

Problem creating a Maintenance Plan

When trying to create a maintenance plan using the wizard to backup the
system databases in SQL 2005 the following error is displayed.
How can I find what is causing this problem with a simple maintenance
plan?
Maintenance Plan Wizard Progress
- Creating maintenance plan "SystemDBs Backup" (Error)
Messages
* Create maintenance plan failed.
--
ADDITIONAL INFORMATION:
Create failed for JobStep 'Subplan'.
(Microsoft.SqlServer.MaintenancePlanTasks)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+JobStep&LinkId=20476
--
An exception occurred while executing a Transact-SQL statement or
batch. (Microsoft.SqlServer.ConnectionInfo)
--
The specified '@.subsystem' is invalid (valid values are returned by
sp_enum_sqlagent_subsystems). (Microsoft SQL Server, Error: 14234)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=14234&LinkId=20476
- Adding tasks to the maintenance plan (Stopped)
- Adding scheduling options (Stopped)
- Adding reporting options (Stopped)
- Saving maintenance plan "SystemDBs Backup" (Stopped)Did you install Integration Services?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<robin9876@.hotmail.com> wrote in message
news:1165336377.424898.184600@.16g2000cwy.googlegroups.com...
> When trying to create a maintenance plan using the wizard to backup the
> system databases in SQL 2005 the following error is displayed.
> How can I find what is causing this problem with a simple maintenance
> plan?
>
> Maintenance Plan Wizard Progress
> - Creating maintenance plan "SystemDBs Backup" (Error)
> Messages
> * Create maintenance plan failed.
> --
> ADDITIONAL INFORMATION:
> Create failed for JobStep 'Subplan'.
> (Microsoft.SqlServer.MaintenancePlanTasks)
> For help, click:
> http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+JobStep&LinkId=20476
> --
> An exception occurred while executing a Transact-SQL statement or
> batch. (Microsoft.SqlServer.ConnectionInfo)
> --
> The specified '@.subsystem' is invalid (valid values are returned by
> sp_enum_sqlagent_subsystems). (Microsoft SQL Server, Error: 14234)
> For help, click:
> http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=14234&LinkId=20476
>
> - Adding tasks to the maintenance plan (Stopped)
> - Adding scheduling options (Stopped)
> - Adding reporting options (Stopped)
> - Saving maintenance plan "SystemDBs Backup" (Stopped)
>|||Integration Services are not installed on this server but other servers
without it the plans can be created.
Tibor Karaszi wrote:
> Did you install Integration Services?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> <robin9876@.hotmail.com> wrote in message
> news:1165336377.424898.184600@.16g2000cwy.googlegroups.com...
> > When trying to create a maintenance plan using the wizard to backup the
> > system databases in SQL 2005 the following error is displayed.
> >
> > How can I find what is causing this problem with a simple maintenance
> > plan?
> >
> >
> > Maintenance Plan Wizard Progress
> >
> > - Creating maintenance plan "SystemDBs Backup" (Error)
> > Messages
> > * Create maintenance plan failed.
> >
> > --
> > ADDITIONAL INFORMATION:
> >
> > Create failed for JobStep 'Subplan'.
> > (Microsoft.SqlServer.MaintenancePlanTasks)
> >
> > For help, click:
> > http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+JobStep&LinkId=20476
> >
> > --
> >
> > An exception occurred while executing a Transact-SQL statement or
> > batch. (Microsoft.SqlServer.ConnectionInfo)
> >
> > --
> >
> > The specified '@.subsystem' is invalid (valid values are returned by
> > sp_enum_sqlagent_subsystems). (Microsoft SQL Server, Error: 14234)
> >
> > For help, click:
> > http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=14234&LinkId=20476
> >
> >
> > - Adding tasks to the maintenance plan (Stopped)
> >
> > - Adding scheduling options (Stopped)
> >
> > - Adding reporting options (Stopped)
> >
> > - Saving maintenance plan "SystemDBs Backup" (Stopped)
> >|||I see... Well, to the best of my knowledge, you need SSIS to execute an MP (in 2005), since an MP is
an SSIS package.
I've heard that you won't need this with sp2, but sp2 is still only in CTP.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<robin9876@.hotmail.com> wrote in message
news:1165355311.079516.289340@.j72g2000cwa.googlegroups.com...
> Integration Services are not installed on this server but other servers
> without it the plans can be created.
> Tibor Karaszi wrote:
>> Did you install Integration Services?
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> <robin9876@.hotmail.com> wrote in message
>> news:1165336377.424898.184600@.16g2000cwy.googlegroups.com...
>> > When trying to create a maintenance plan using the wizard to backup the
>> > system databases in SQL 2005 the following error is displayed.
>> >
>> > How can I find what is causing this problem with a simple maintenance
>> > plan?
>> >
>> >
>> > Maintenance Plan Wizard Progress
>> >
>> > - Creating maintenance plan "SystemDBs Backup" (Error)
>> > Messages
>> > * Create maintenance plan failed.
>> >
>> > --
>> > ADDITIONAL INFORMATION:
>> >
>> > Create failed for JobStep 'Subplan'.
>> > (Microsoft.SqlServer.MaintenancePlanTasks)
>> >
>> > For help, click:
>> > http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+JobStep&LinkId=20476
>> >
>> > --
>> >
>> > An exception occurred while executing a Transact-SQL statement or
>> > batch. (Microsoft.SqlServer.ConnectionInfo)
>> >
>> > --
>> >
>> > The specified '@.subsystem' is invalid (valid values are returned by
>> > sp_enum_sqlagent_subsystems). (Microsoft SQL Server, Error: 14234)
>> >
>> > For help, click:
>> > http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=14234&LinkId=20476
>> >
>> >
>> > - Adding tasks to the maintenance plan (Stopped)
>> >
>> > - Adding scheduling options (Stopped)
>> >
>> > - Adding reporting options (Stopped)
>> >
>> > - Saving maintenance plan "SystemDBs Backup" (Stopped)
>> >
>

Problem creating a function from an assembly

I have compiled a dll with the following code:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Server
Imports System.Data.SqlTypes

Public Class SICTrans

Public Shared Function TransSIC(ByVal inpSIC As String) As String
'Dim conn As SqlConnection = New SqlConnection("context connection=true")
Dim NewSIC, TempSIC, tempFSIC As String

If Len(NZ(inpSIC)) > 0 Then
TempSIC = NZ(inpSIC)

If Len(TempSIC) < 5 Then TempSIC = Left("00000", 5 - Len(TempSIC))

tempFSIC = Left(TempSIC, 2) + "." + Mid(TempSIC, 3, 2)

If Val(Right(TempSIC, 1)) > 0 Then

tempFSIC = tempFSIC + "/" + Right(TempSIC, 1)
End If
End If

NewSIC = tempFSIC

TransSIC = NewSIC

End Function
Public Shared Function NZ(ByVal input As String) As String
If Not (input Is Nothing) Then
Return input
Exit Function
End If
Return String.Empty

End Function
End Class

Which compiles fine...

i then use the following code to create the assembly in SQL which is fine:

USE NARD
GO
CREATE ASSEMBLY SICCodeTrans
FROM 'c:\SICCodeTrans.dll'
WITH PERMISSION_SET = SAFE
GO

but when i goto create the function with the following code it wont have it!

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.SICTrans.TransSIC
GO

It gives me the following error message

Msg 6505, Level 16, State 1, Procedure TransSICCode, Line 1
Could not find Type 'SICTrans' in assembly 'SICCodeTrans'.

Any ideas?

Thanks

Marek Kluczynski

I think what's going on here is that there is a root namespace on the project.

IIRC, in a C# project VS will simply insert the root namespace delcaration into your code when you use certain templates. In VB, on the other hand, the compiler decides to insert the namespace definition without having it show up in the code.

When you go to create the function in SQL, it can't find it because there is no SICTrans class in the default namespace, there is a SICTrans class in whatever root namespace was set on the project.

You can right-click on the project in VS and pull up the propertiesunder the "Application" tab you'll see this.

Assuming your namespace is NAMESPACE, you'd think you could do the following:

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.NAMESPACE.SICTrans.TransSIC
GO

This won't workit's a (rather annoying) syntax error. You have to write it like this:

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.[NAMESPACE.SICTrans].TransSIC
GO

Hope this works for you. Let us know. :)

Cheers
-Isaac

|||

yes this seems to have resolved the namespace error.

I now have the following error:

Msg 6551, Level 16, State 2, Procedure TransSICCode, Line 1

CREATE FUNCTION for "TransSICCode" failed because T-SQL and CLR types for return value do not match.

Many thanks

Marek

|||I suspect two things. First, you should map the string to an nvarchar, not a varcharCLR strings are Unicode. Second, you need to give a parameter to the nvarchar, e.g., nvarchar(4000), nvarchar(max), etc.

Cheers,
-Isaac|||Many thanks for all your help

Problem creating a function from an assembly

I have compiled a dll with the following code:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Server
Imports System.Data.SqlTypes

Public Class SICTrans

Public Shared Function TransSIC(ByVal inpSIC As String) As String
'Dim conn As SqlConnection = New SqlConnection("context connection=true")
Dim NewSIC, TempSIC, tempFSIC As String

If Len(NZ(inpSIC)) > 0 Then
TempSIC = NZ(inpSIC)

If Len(TempSIC) < 5 Then TempSIC = Left("00000", 5 - Len(TempSIC))

tempFSIC = Left(TempSIC, 2) + "." + Mid(TempSIC, 3, 2)

If Val(Right(TempSIC, 1)) > 0 Then

tempFSIC = tempFSIC + "/" + Right(TempSIC, 1)
End If
End If

NewSIC = tempFSIC

TransSIC = NewSIC

End Function
Public Shared Function NZ(ByVal input As String) As String
If Not (input Is Nothing) Then
Return input
Exit Function
End If
Return String.Empty

End Function
End Class

Which compiles fine...

i then use the following code to create the assembly in SQL which is fine:

USE NARD
GO
CREATE ASSEMBLY SICCodeTrans
FROM 'c:\SICCodeTrans.dll'
WITH PERMISSION_SET = SAFE
GO

but when i goto create the function with the following code it wont have it!

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.SICTrans.TransSIC
GO

It gives me the following error message

Msg 6505, Level 16, State 1, Procedure TransSICCode, Line 1
Could not find Type 'SICTrans' in assembly 'SICCodeTrans'.

Any ideas?

Thanks

Marek Kluczynski

I think what's going on here is that there is a root namespace on the project.

IIRC, in a C# project VS will simply insert the root namespace delcaration into your code when you use certain templates. In VB, on the other hand, the compiler decides to insert the namespace definition without having it show up in the code.

When you go to create the function in SQL, it can't find it because there is no SICTrans class in the default namespace, there is a SICTrans class in whatever root namespace was set on the project.

You can right-click on the project in VS and pull up the propertiesunder the "Application" tab you'll see this.

Assuming your namespace is NAMESPACE, you'd think you could do the following:

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.NAMESPACE.SICTrans.TransSIC
GO

This won't workit's a (rather annoying) syntax error. You have to write it like this:

CREATE FUNCTION TransSICCode(@.inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.[NAMESPACE.SICTrans].TransSIC
GO

Hope this works for you. Let us know. :)

Cheers
-Isaac

|||

yes this seems to have resolved the namespace error.

I now have the following error:

Msg 6551, Level 16, State 2, Procedure TransSICCode, Line 1

CREATE FUNCTION for "TransSICCode" failed because T-SQL and CLR types for return value do not match.

Many thanks

Marek

|||I suspect two things. First, you should map the string to an nvarchar, not a varcharCLR strings are Unicode. Second, you need to give a parameter to the nvarchar, e.g., nvarchar(4000), nvarchar(max), etc.

Cheers,
-Isaac|||Many thanks for all your help

Monday, February 20, 2012

Problem connection to Express Edition with C#

I'm using .NET 2.0 and SQL Server 2005 Express Edition on WinXP SP2. I'm
using System.Data.SqlClient to connect to the server which is on the same
machine. The SQL Server service is set to log on as "Built-in account: Local
System" and the connection string I'm passing to the constructor is "Data
Source=(local);Initial Catalog=TestDB;" everything else is set to defaults.
I get the following error: "System.Data.SqlClient.SqlException: 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)"
Any help would be greatly appreciated.
I was fiddling around with different connection strings and this one finally
allowed me to connect: "Data Source=.\\SQLEXPRESS;Initial
Catalog=TestDB;Integrated Security=SSPI;"
"Frustrated" wrote:

> I'm using .NET 2.0 and SQL Server 2005 Express Edition on WinXP SP2. I'm
> using System.Data.SqlClient to connect to the server which is on the same
> machine. The SQL Server service is set to log on as "Built-in account: Local
> System" and the connection string I'm passing to the constructor is "Data
> Source=(local);Initial Catalog=TestDB;" everything else is set to defaults.
> I get the following error: "System.Data.SqlClient.SqlException: 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)"
> Any help would be greatly appreciated.
|||You 'normally' always provide at least three pieces of information for a
connection. The Server, the database, and the security context.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Frustrated" <Frustrated@.discussions.microsoft.com> wrote in message
news:0C3946E2-F417-4345-94E7-57B0BA6F9169@.microsoft.com...[vbcol=seagreen]
>I was fiddling around with different connection strings and this one
>finally
> allowed me to connect: "Data Source=.\\SQLEXPRESS;Initial
> Catalog=TestDB;Integrated Security=SSPI;"
> "Frustrated" wrote:

Problem connection to Express Edition with C#

I'm using .NET 2.0 and SQL Server 2005 Express Edition on WinXP SP2. I'm
using System.Data.SqlClient to connect to the server which is on the same
machine. The SQL Server service is set to log on as "Built-in account: Local
System" and the connection string I'm passing to the constructor is "Data
Source=(local);Initial Catalog=TestDB;" everything else is set to defaults.
I get the following error: "System.Data.SqlClient.SqlException: 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)
"
Any help would be greatly appreciated.I was fiddling around with different connection strings and this one finally
allowed me to connect: "Data Source=.\\SQLEXPRESS;Initial
Catalog=TestDB;Integrated Security=SSPI;"
"Frustrated" wrote:

> I'm using .NET 2.0 and SQL Server 2005 Express Edition on WinXP SP2. I'm
> using System.Data.SqlClient to connect to the server which is on the same
> machine. The SQL Server service is set to log on as "Built-in account: Loc
al
> System" and the connection string I'm passing to the constructor is "Data
> Source=(local);Initial Catalog=TestDB;" everything else is set to defaults
.
> I get the following error: "System.Data.SqlClient.SqlException: An error h
as
> occurred while establishing a connection to the server. When connecting t
o
> 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 Serve
r)"
> Any help would be greatly appreciated.|||You 'normally' always provide at least three pieces of information for a
connection. The Server, the database, and the security context.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Frustrated" <Frustrated@.discussions.microsoft.com> wrote in message
news:0C3946E2-F417-4345-94E7-57B0BA6F9169@.microsoft.com...[vbcol=seagreen]
>I was fiddling around with different connection strings and this one
>finally
> allowed me to connect: "Data Source=.\\SQLEXPRESS;Initial
> Catalog=TestDB;Integrated Security=SSPI;"
> "Frustrated" wrote:
>