Showing posts with label execute. Show all posts
Showing posts with label execute. Show all posts

Friday, March 30, 2012

problem with c# stored procedure calling a class

I wrote a stored procedure in c# that calls a class. It deployed fine but when I try to execute it, I get the error...

Msg 6522, Level 16, State 1, Procedure UpdateJobAdSearch, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'UpdateJobAdSearch':
System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at JobAd.WhaleJobAd.CreateSearchableRecord()
at JobAd.WhaleJobAd.CreateSearchableRecord(String JobId)
at StoredProcedures.UpdateJobAdSearch(String JobAdId)

I read an article on MSDN that didn't directly relate, but mentioned the same error message. It suggested using...

System.Data.SqlClient.SqlClientPermission pSql = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
pSql.Assert();

I tried that, but I get the same error.

I finally found the answer to this. I needed to set the projects properties > database permission level to external. However, I don't understand why. I've scaled back my code, pulled it out the class so everything executes in the stored procedures method call and all it does it create 2 connections to the local database and pull info from 6 tables and put that info into 1. It's not trying to access anything outside the database, so why does it have to be set to external? In order to get that to work, I had to then alter the database and turn trustworthy on which is scary because of the security holes that opens up.|||

cakewalkr7:

I've scaled back my code, pulled it out the class so everything executes in the stored procedures method call and all it does it create 2 connections to the local database and pull info from 6 tables and put that info into 1.

I think maybe connections opened by the class are considered as access to external resource. Did you try to open a connection in this way?

SqlConnection conn = new SqlConnection("context connection = true");

sql

Wednesday, March 28, 2012

Problem with BCP command

I am trying to execute following command using xp_cmdshell

EXEC master..xp_cmdshell 'bcp "select nc_value from fileade.dbo.nms_command (nolock) order by nc_pk desc" queryout \\filw\ExternalTools\NMS3\reports\NMS3_20070525_051507.txt -c -S"FILW2K" -Uabc -Pabc'

but the error message returned is

Copy direction must be either 'in' or 'out'.

Syntax Error in 'queryout'.

usage: bcp [[database_name.]owner.]table_name[Tongue Tiedlice_number] {in | out} datafile

[-m maxerrors] [-f formatfile] [-e errfile]

[-F firstrow] [-L lastrow] [-b batchsize]

[-n] [-c] [-t field_terminator] [-r row_terminator]

[-U username] [-P password] [-I interfaces_file] [-S server]

[-a display_charset] [-q datafile_charset] [-z language] [-v]

[-A packet size] [-J client character set]

[-T text or image size] [-E] [-g id_start_value] [-N] [-X]

[-M LabelName LabelValue] [-labeled]

[-K keytab_file] [-R remote_server_principal]

[-V [security_options]] [-Z security_mechanism] [-Q]

NULL

Further the same command is running successfully in my DEV environment.

That sounds like you have a SQL 7 bcp.exe in your path. Run "bcp -v" on both machines and make sure the versions match.

|||Wrong forum. Moving to Transact-SQL.|||

When the path for the output file contains spaces or other 'non-acceptable' characters, you 'should' enclose it in double quotes.

The Server name does not need to be in double quotes.

|||

Hi Tom,

I have checked the version on all the three plateform

DEV : 8.00.382

PROD : 8.00.382

TestPROD : 8.00.382

and version are same.

|||

Hi Arnie,

The command is giving problem on Production environment only while in DEV & staging server working perfectly wheather to export file in local drive or in a network drive.

|||On the production server, does the SQL Agent account have permissions for the file locations?|||

Not Sure how to check this,

BUt we have checkred that other scheduled JOBS which also export some file from PROD DB server to other server are working OK, Further the BCP command is executed via windows service

Windows Service

Batch File

Stored Procedure

BCP Command.

|||Somewhere you have an old bcp.exe which is being picked up. The error message you posted above is from the SQL 7 bcp.exe program, not 8.00.382. The "queryout" option was added in SQL 2000 bcp.exe.

Search your hard drive for bcp.exe and remove anything not in C:\Program Files\Microsoft SQL Server\90 (or 80)\tools\binn.

|||

Hi Tom,

Your check point really help me to found the the problem although Production Hard Drive was not having the bcp.exe of version 7 instead the server was having Sybase BCP.EXE also , so whenever the window service try to execute the BCP command instead of picking up the SQL Server BCP path it was picking the Syabse BCP due to which the error was coming.

Thanks again for your help.

|||Good. I am glad you found it.

sql

Problem with BCP

Hi,
I execute this command in CMD:
bcp pubs..authors out c:\test.dat -T -n
I get the following error:
Code page 720 is not supported by SQL Server.
Unable to resolve column level collation.
I'm using Personal Edition on Win XP Prof. I have not modified anything in
pubs database.
Any help would be greatly appreciated.
LeilaHi
You may want to try the -C option to specify 720 or RAW. Alternatively a
format file specifying the collation may work.
http://msdn.microsoft.com/library/d...>
bcp_1y43.asp
John
"Leila" <leilas@.hotpop.com> wrote in message
news:eUUw97aTFHA.2172@.tk2msftngp13.phx.gbl...
> Hi,
> I execute this command in CMD:
> bcp pubs..authors out c:\test.dat -T -n
> I get the following error:
> Code page 720 is not supported by SQL Server.
> Unable to resolve column level collation.
> I'm using Personal Edition on Win XP Prof. I have not modified anything in
> pubs database.
> Any help would be greatly appreciated.
> Leila
>
>|||Thanks John!
RAW worked :-)
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:#gQu8whTFHA.3620@.TK2MSFTNGP09.phx.gbl...
> Hi
> You may want to try the -C option to specify 720 or RAW. Alternatively a
> format file specifying the collation may work.
>
http://msdn.microsoft.com/library/d...-us/adminsql/ad
_impt_bcp_1y43.asp
> John
> "Leila" <leilas@.hotpop.com> wrote in message
> news:eUUw97aTFHA.2172@.tk2msftngp13.phx.gbl...
in
>

Monday, March 26, 2012

Problem with attaching database on network share (SQL Server 2005)

I'm trying to execute following command:
DBCC TRACEON (1807, -1);
sp_attach_db @.dbname = N'PGDT', @.filename1 = N'\\Server\D\SQL
DataBase\PGDT\PGDT.mdf', @.filename2 = '\\Server\D\SQL
DataBase\PGDT\PGDT_log.ldf'
and I get following error:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "\\Server\D\SQL DataBase\PGDT\PGDT.mdf" failed
with the operating system error 5(error not found).
Note: this file exists and I have full permissions
Any help appreciated.
Hi
Do you have permission to this path?
Why would you want to do that? RESTORE , doesn't help you?
"D" <destro@.mail.com> wrote in message news:dmedq5$sv8$1@.ss405.t-com.hr...
> I'm trying to execute following command:
> DBCC TRACEON (1807, -1);
> sp_attach_db @.dbname = N'PGDT', @.filename1 = N'\\Server\D\SQL
> DataBase\PGDT\PGDT.mdf', @.filename2 = '\\Server\D\SQL
> DataBase\PGDT\PGDT_log.ldf'
> and I get following error:
> Msg 5133, Level 16, State 1, Line 1
> Directory lookup for the file "\\Server\D\SQL DataBase\PGDT\PGDT.mdf"
> failed with the operating system error 5(error not found).
>
> Note: this file exists and I have full permissions
> Any help appreciated.
>
|||Solved!
I had to start sql server under Administrator account, and not local
account.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:euzNHQ$8FHA.2040@.TK2MSFTNGP14.phx.gbl...
> Hi
> Do you have permission to this path?
> Why would you want to do that? RESTORE , doesn't help you?
>
> "D" <destro@.mail.com> wrote in message news:dmedq5$sv8$1@.ss405.t-com.hr...
>
|||Yup - worked like that in SQL 2000 as well (for remote backups and
restores). You will probably need to check that other services e.g.
agent can still work with SQL running on the domain account. Agree with
above - a remote ATTACH sounds like a pretty risky idea - performance
will likely be lousy and could be fragile as network issues will
destabilise?

Problem with attaching database on network share (SQL Server 2005)

I'm trying to execute following command:
DBCC TRACEON (1807, -1);
sp_attach_db @.dbname = N'PGDT', @.filename1 = N'\\Server\D\SQL
DataBase\PGDT\PGDT.mdf', @.filename2 = '\\Server\D\SQL
DataBase\PGDT\PGDT_log.ldf'
and I get following error:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "\\Server\D\SQL DataBase\PGDT\PGDT.mdf" failed
with the operating system error 5(error not found).
Note: this file exists and I have full permissions
Any help appreciated.Hi
Do you have permission to this path?
Why would you want to do that? RESTORE , doesn't help you?
"D" <destro@.mail.com> wrote in message news:dmedq5$sv8$1@.ss405.t-com.hr...
> I'm trying to execute following command:
> DBCC TRACEON (1807, -1);
> sp_attach_db @.dbname = N'PGDT', @.filename1 = N'\\Server\D\SQL
> DataBase\PGDT\PGDT.mdf', @.filename2 = '\\Server\D\SQL
> DataBase\PGDT\PGDT_log.ldf'
> and I get following error:
> Msg 5133, Level 16, State 1, Line 1
> Directory lookup for the file "\\Server\D\SQL DataBase\PGDT\PGDT.mdf"
> failed with the operating system error 5(error not found).
>
> Note: this file exists and I have full permissions
> Any help appreciated.
>|||Solved!
I had to start sql server under Administrator account, and not local
account.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:euzNHQ$8FHA.2040@.TK2MSFTNGP14.phx.gbl...
> Hi
> Do you have permission to this path?
> Why would you want to do that? RESTORE , doesn't help you?
>
> "D" <destro@.mail.com> wrote in message news:dmedq5$sv8$1@.ss405.t-com.hr...
>|||Yup - worked like that in SQL 2000 as well (for remote backups and
restores). You will probably need to check that other services e.g.
agent can still work with SQL running on the domain account. Agree with
above - a remote ATTACH sounds like a pretty risky idea - performance
will likely be lousy and could be fragile as network issues will
destabilise?

Problem with attaching database on network share (SQL Server 2005)

I'm trying to execute following command:
DBCC TRACEON (1807, -1);
sp_attach_db @.dbname = N'PGDT', @.filename1 = N'\\Server\D\SQL
DataBase\PGDT\PGDT.mdf', @.filename2 = '\\Server\D\SQL
DataBase\PGDT\PGDT_log.ldf'
and I get following error:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "\\Server\D\SQL DataBase\PGDT\PGDT.mdf" failed
with the operating system error 5(error not found).
Note: this file exists and I have full permissions
Any help appreciated.Hi
Do you have permission to this path?
Why would you want to do that? RESTORE , doesn't help you?
"D" <destro@.mail.com> wrote in message news:dmedq5$sv8$1@.ss405.t-com.hr...
> I'm trying to execute following command:
> DBCC TRACEON (1807, -1);
> sp_attach_db @.dbname = N'PGDT', @.filename1 = N'\\Server\D\SQL
> DataBase\PGDT\PGDT.mdf', @.filename2 = '\\Server\D\SQL
> DataBase\PGDT\PGDT_log.ldf'
> and I get following error:
> Msg 5133, Level 16, State 1, Line 1
> Directory lookup for the file "\\Server\D\SQL DataBase\PGDT\PGDT.mdf"
> failed with the operating system error 5(error not found).
>
> Note: this file exists and I have full permissions
> Any help appreciated.
>|||Solved!
I had to start sql server under Administrator account, and not local
account.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:euzNHQ$8FHA.2040@.TK2MSFTNGP14.phx.gbl...
> Hi
> Do you have permission to this path?
> Why would you want to do that? RESTORE , doesn't help you?
>
> "D" <destro@.mail.com> wrote in message news:dmedq5$sv8$1@.ss405.t-com.hr...
>> I'm trying to execute following command:
>> DBCC TRACEON (1807, -1);
>> sp_attach_db @.dbname = N'PGDT', @.filename1 = N'\\Server\D\SQL
>> DataBase\PGDT\PGDT.mdf', @.filename2 = '\\Server\D\SQL
>> DataBase\PGDT\PGDT_log.ldf'
>> and I get following error:
>> Msg 5133, Level 16, State 1, Line 1
>> Directory lookup for the file "\\Server\D\SQL DataBase\PGDT\PGDT.mdf"
>> failed with the operating system error 5(error not found).
>>
>> Note: this file exists and I have full permissions
>> Any help appreciated.
>|||Yup - worked like that in SQL 2000 as well (for remote backups and
restores). You will probably need to check that other services e.g.
agent can still work with SQL running on the domain account. Agree with
above - a remote ATTACH sounds like a pretty risky idea - performance
will likely be lousy and could be fragile as network issues will
destabilise?sql

Problem with Analysis Services Provider

Hi,

For some reason I cannot execute reports using the provider "Microsoft SQL Server Analysis Services (AdomdClient)". I can see my cube through the Query Builder and execute the queries with it too, but when I run the query I get an error...

An error has occurred during report processing.
Cannot create a connection to data source 'SalesMartCube'.
A connection cannot be made. Ensure that the server is running.
No connection could be made because the target machine actively refused it

When I change the provider to "Microsoft OLE DB Provider for Analysis Services 9.0" I can execute the report, but I lose the ability to use the MDX query builder with this provider!

Can someone tell me how I can get the analysis services provider to work or how I can get the mdx query builder to work using the old db propvider?

I have no trouble connecting to the Analysis Services server using the sql 2000 "mdx sample application" and I can also connect to it with excel by importing a datasource. But I cannot connect to it from sql management studio 2005, I get a similar error to above. Could it be that sql server 2005 cannot connect to AS2000?

Thanks,

Lachlan

Did you try to add the ConnectTo property to your connection string when connecting to AS 2000:

data source=localhost;initial catalog=SalesMartCube; ConnectTo=8.0

-- Robert

|||

Hi Robert,

I tried your suggestion but I get a different error when I click on the preview pane using "ConnectTo=8.0" in the connection string...

An error has occurred during local report processing.
An error has occurred during report processing.
Cannot create a connection to data source 'SalesMartCube'.
The LCID or Compare String flags have already been set by an existing connection. They cannot be changed.

It seems strange to me that I can see the query results in query builder but get an error on the preview pane.

I've also noticed that some of the query builder features are not available to me such as query parameters, command type and query designer. Is this because I am connecting to AS2000 rather than AS2005?

Thanks for your help.

Lachlan

Friday, March 23, 2012

problem with a stored procedure

Hello guys,
I have again problem with a stored procedure in sql server.
I would like to execute this query
declare @.sSQL varchar(255)
SET @.sSQL =
'SELECT TOP 1 [value], date, name, [times]
FROM (SELECT value, date, times, name
FROM view
WHERE ValueDate =
(SELECT MAX(date)
AS maxdate
FROM view
v
WHERE (date
BETWEEN ''2006-02-01'' AND ''2006-02-28''))) Newtable
WHERE (name = ''TEST'')
GROUP BY [value], date, [times], name
ORDER BY [times] DESC'
EXEC (@.sSQL)
When I execute the query I have no problem but ... when i tried to
stored it I have this several problem I do not know why ... something
like
Line 4: Incorrect syntax near '='
I would like be able to pass variable on it and create function to
store the results in a table.
Please someone could help me on that.
Inaina
Replace EXEC(@.sql) with PRINT @.sql in order to debug and try run it in the
QA.
"ina" <roberta.inalbon@.gmail.com> wrote in message
news:1144763910.125857.198630@.e56g2000cwe.googlegroups.com...
> Hello guys,
> I have again problem with a stored procedure in sql server.
> I would like to execute this query
> declare @.sSQL varchar(255)
>
> SET @.sSQL =
> 'SELECT TOP 1 [value], date, name, [times]
> FROM (SELECT value, date, times, name
> FROM view
> WHERE ValueDate =
> (SELECT MAX(date)
> AS maxdate
> FROM view
> v
> WHERE (date
> BETWEEN ''2006-02-01'' AND ''2006-02-28''))) Newtable
> WHERE (name = ''TEST'')
> GROUP BY [value], date, [times], name
> ORDER BY [times] DESC'
> EXEC (@.sSQL)
> When I execute the query I have no problem but ... when i tried to
> stored it I have this several problem I do not know why ... something
> like
> Line 4: Incorrect syntax near '='
> I would like be able to pass variable on it and create function to
> store the results in a table.
> Please someone could help me on that.
> Ina
>|||> When I execute the query I have no problem but ... when i tried to
> stored it
What does "tried to stored it" mean?

> I would like be able to pass variable on it and create function to
> store the results in a table.
Well, you can't execute dynamic SQL inside a function. If you provide
better specifications on exactly what you are trying to accomplish (instead
of describing how you are already trying to accomplish it), we may be able
to provide better assistance.|||Is it actually spanning multiple lines in your stored procedure? I don't
think this is allowed. Strings have to be contained on a single line.
Either put everything on one line, or concatenate each line to the end of
@.sSQL
Also, 255 is probably not long enough to contain your SQL. Bump this up to
2000 and it should handle most reasonable sql statements.
Lastly, don't ever use dynamic SQL if you have a choice. There are times
when it is needed, but you should simply be able to pass the parameters
inside the stored procedure without dynamic SQL.
Look up "Parameters" in books on line for an explanation of how to use them.
"ina" <roberta.inalbon@.gmail.com> wrote in message
news:1144763910.125857.198630@.e56g2000cwe.googlegroups.com...
> Hello guys,
> I have again problem with a stored procedure in sql server.
> I would like to execute this query
> declare @.sSQL varchar(255)
>
> SET @.sSQL =
> 'SELECT TOP 1 [value], date, name, [times]
> FROM (SELECT value, date, times, name
> FROM view
> WHERE ValueDate =
> (SELECT MAX(date)
> AS maxdate
> FROM view
> v
> WHERE (date
> BETWEEN ''2006-02-01'' AND ''2006-02-28''))) Newtable
> WHERE (name = ''TEST'')
> GROUP BY [value], date, [times], name
> ORDER BY [times] DESC'
> EXEC (@.sSQL)
> When I execute the query I have no problem but ... when i tried to
> stored it I have this several problem I do not know why ... something
> like
> Line 4: Incorrect syntax near '='
> I would like be able to pass variable on it and create function to
> store the results in a table.
> Please someone could help me on that.
> Ina
>|||> Is it actually spanning multiple lines in your stored procedure? I don't
> think this is allowed. Strings have to be contained on a single line.
Strings can span lines. The only (obvious) limitation is the fact that they
need to be enclosed in single quotes.
ML
http://milambda.blogspot.com/|||Thank you for your help and I am sorry ... but I am really newbie and I
am trying to introduce my self in sql server programming.
What I am trying to do it is:
My main query gives to me the max value for a ticket during a period of
time. What I would like to do is the to have the max value for each end
of month for a ticket. each ticket has its own creation date and as
this period I would like to have the max value until today.
For example:
NameTicket |creation_date |month |year |value
----
-
Ticket1 2005-09-15 September 2005 120
ticket 1 2005-09-15 October 2005 125
Ticket 1 2005-09-15 November 2005 152
Ticket 1 2005-09-15 December 2005 152
Sometimes there is no value for one month so it needs to take the max
value for the previous month.
What I would like to do with my query is how to set parameter for sql,
in that what I can set the ticketname and period.
Thank you a lot for your help
Ina|||Thank you for your help and I am sorry ... but I am really newbie and I
am trying to introduce my self in sql server programming.
What I am trying to do it is:
My main query gives to me the max value for a ticket during a period of
time. What I would like to do is the to have the max value for each end
of month for a ticket. each ticket has its own creation date and as
this period I would like to have the max value until today.
For example:
NameTicket |creation_date |month |year |value
----
-
Ticket1 2005-09-15 September 2005 120
ticket 1 2005-09-15 October 2005 125
Ticket 1 2005-09-15 November 2005 152
Ticket 1 2005-09-15 December 2005 152
Sometimes there is no value for one month so it needs to take the max
value for the previous month.
What I would like to do with my query is how to set parameter for sql,
in that what I can set the ticketname and period.
Thank you a lot for your help
Ina|||This sounds better and fairly simple to acomplish. All we need now is DDL an
d
sample data.
This article will help you help us:
http://www.aspfaq.com/etiquette.asp?id=5006
ML
http://milambda.blogspot.com/|||Thank you I will go through that and try to find the solution of my
problem. Thank you :D|||Hello,
I tried to see that but what I need it is to have the max of each month
since the startdate until endate. I already have the max of the period
a set. how to have the list of all period.
Can I use the function month() to accomplish it?
ina

problem with a stored procedure

Hello guys,
I have again problem with a stored procedure in sql server.
I would like to execute this query
declare @.sSQL varchar(255)
SET @.sSQL =
'SELECT TOP 1 [value], date, name, [times]
FROM (SELECT value, date, times, name
FROM view
WHERE ValueDate =
(SELECT MAX(date)
AS maxdate
FROM view
v
WHERE (date
BETWEEN ''2006-02-01'' AND ''2006-02-28''))) Newtable
WHERE (name = ''MIREMONT TEST'')
GROUP BY [value], date, [times], name
ORDER BY [times] DESC'
EXEC (@.sSQL)
When I execute the query I have no problem but ... when i tried to
stored it I have this several problem I do not know why ... something
like
Line 4: Incorrect syntax near '='
I would like be able to pass variable on it and create function to
store the results in a table.
Please someone could help me on that.
InaI think variable @.sSQL je very short:
Try declare @.sSQL varchar(2000)
"ina" wrote:

> Hello guys,
> I have again problem with a stored procedure in sql server.
> I would like to execute this query
> declare @.sSQL varchar(255)
>
> SET @.sSQL =
> 'SELECT TOP 1 [value], date, name, [times]
> FROM (SELECT value, date, times, name
> FROM view
> WHERE ValueDate =
> (SELECT MAX(date)
> AS maxdate
> FROM view
> v
> WHERE (date
> BETWEEN ''2006-02-01'' AND ''2006-02-28''))) Newtable
> WHERE (name = ''MIREMONT TEST'')
> GROUP BY [value], date, [times], name
> ORDER BY [times] DESC'
> EXEC (@.sSQL)
> When I execute the query I have no problem but ... when i tried to
> stored it I have this several problem I do not know why ... something
> like
> Line 4: Incorrect syntax near '='
> I would like be able to pass variable on it and create function to
> store the results in a table.
> Please someone could help me on that.
> Ina
>

Wednesday, March 21, 2012

Problem with a script to create a DB

hi, I am writing from argentina, and the question is beacuse I have problems to create a new DB from a script, in SQL Express Edition
when I execute the query the following erros appears:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "c:\dce05\dce05_ejemplos_estrella1_Data.MDF" failed with the operating system error 2(El sistema no puede hallar el archivo especificado.).
Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Msg 911, Level 16, State 1, Line 2
Could not locate entry in sysdatabases for database 'dce05_ejemplos_estrella1'. No entry found with that name. Make sure that the name is entered correctly.
Msg 2714, Level 16, State 6, Line 3
There is already an object named 'Productos' in the database.

I am thankful to who helps to solve the problem me
See this file....

http://www.moleculardevices.com/technotes_d1/MDC_D1_D50007_TroubleshootDB.pdf

If the method doesnt work ,then

see this troubleshooting method given on MSDN for the error msg 911
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_reslsyserr_1_2d4h.asp

and then finally do this
http://msdn2.microsoft.com/en-us/library/aa933271(SQL.80).aspx

have a nice day...tell me wether it worked or not
|||

post the script... and also is this DEC05 directory exists ... if not create it... if exists then check the permission

pse post the script

Madhu

Monday, March 12, 2012

Problem when using linked server

Hi everyone,

I've got problem querying remote tables via a specific linked server.
The server from which I execute the query is an SQLServer2005 and the linked server is an SQLServer2000.

If I do select * from <linked server>.<database name>.<db owner>.<Table1> after a while I get the following error message
"Server: Msg 10054, Level 16, State 1, Line 0, TCP Provider: An existing connection was forcibly closed by the remote host."

I execute the query using profiler and I got the following profiler error: 'OLE DB provider "Unknown" for linked server "(null)" supported the schema lock interface, but returned "0x80040e96" for "ReleaseSchemaLock".' (The query returns a subset of records before it is forcibly stopped)

The strange thing is that i used to run the same query a week or two ago and faced no problem.

Please help.

Hey Kilo

I have had this problem before also. I think its a bug in SQL 2005. Although I have not tried it yet, I think SP2 fixed the issue. Give that a shot.

|||See this blog http://blogs.msdn.com/sql_protocols/archive/2006/04/12/574608.aspx that refers the issues.|||

Hey Satya,

Thank u for your reply.

The link tha u sent me explains thye problem / posiible solution for sql server 2005 + Windows Server 2003. However in our case sql server 2005 is installed on a Windows 2000 operating system. Here is another clue:

Using profiler to map communication between sql server 2005 and sql server 2000 we get the following rows:

RPC:Completed exec sp_reset_connection .Net SqlClient Data Provider sa 0 0 0 0 776 68 2007-02-13 23:44:55.530 2007-02-13 23:44:55.530 0X00000000000000002600730070005F00720065007300650074005F0063006F006E006E0065006300740069006F006E00
User Error Message Changed database context to 'msdb'. SQLAgent - Step History Logger Administrator OPEN24\Administrator 2804 67 2007-02-13 23:44:58.890


User Error Message Changed language setting to us_english. SQLAgent - Step History Logger Administrator OPEN24\Administrator 2804 67 2007-02-13 23:44:58.890

When is sp_reset_connection exececuted?

Is there another parameter / event that we have to map in order to find the source of the problem?

|||It is an undocumented Proc that's used internally by SQL. You usually see it when connection pooling is being used--SQL Server uses it to reset the connection options and settings before reusing the connection.

Problem when using linked server

Hi everyone,

I've got problem querying remote tables via a specific linked server.
The server from which I execute the query is an SQLServer2005 and the linked server is an SQLServer2000.

If I do select * from <linked server>.<database name>.<db owner>.<Table1> after a while I get the following error message
"Server: Msg 10054, Level 16, State 1, Line 0, TCP Provider: An existing connection was forcibly closed by the remote host."

I execute the query using profiler and I got the following profiler error: 'OLE DB provider "Unknown" for linked server "(null)" supported the schema lock interface, but returned "0x80040e96" for "ReleaseSchemaLock".' (The query returns a subset of records before it is forcibly stopped)

The strange thing is that i used to run the same query a week or two ago and faced no problem.

Please help.

Hey Kilo

I have had this problem before also. I think its a bug in SQL 2005. Although I have not tried it yet, I think SP2 fixed the issue. Give that a shot.

|||See this blog http://blogs.msdn.com/sql_protocols/archive/2006/04/12/574608.aspx that refers the issues.|||

Hey Satya,

Thank u for your reply.

The link tha u sent me explains thye problem / posiible solution for sql server 2005 + Windows Server 2003. However in our case sql server 2005 is installed on a Windows 2000 operating system. Here is another clue:

Using profiler to map communication between sql server 2005 and sql server 2000 we get the following rows:

RPC:Completed exec sp_reset_connection .Net SqlClient Data Provider sa 0 0 0 0 776 68 2007-02-13 23:44:55.530 2007-02-13 23:44:55.530 0X00000000000000002600730070005F00720065007300650074005F0063006F006E006E0065006300740069006F006E00
User Error Message Changed database context to 'msdb'. SQLAgent - Step History Logger Administrator OPEN24\Administrator 2804 67 2007-02-13 23:44:58.890


User Error Message Changed language setting to us_english. SQLAgent - Step History Logger Administrator OPEN24\Administrator 2804 67 2007-02-13 23:44:58.890

When is sp_reset_connection exececuted?

Is there another parameter / event that we have to map in order to find the source of the problem?

|||It is an undocumented Proc that's used internally by SQL. You usually see it when connection pooling is being used--SQL Server uses it to reset the connection options and settings before reusing the connection.

Problem when passing parameter to Execute SQL Task

Hi!

I have a execute sql task to create and drop logins. I want to create/drop the ASPNET login, but I need to pass the domain using a parameter. So I mapped a parameter:

Variable name: User::serverName

Direction: Input

DataType: Varchar

Parameter Name:0

and the sql is the following:

CREATE LOGIN [?\ASPNET] FROM WINDOWS

But I get the error:

Executing the query "CREATE LOGIN [?\ASPNET] FROM WINDOWS failed with the following error: "Windows NT user or group '?\ASPNET' not found. Check the name again.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

What am I doing wrong?

Thank you!

Did you set the "BypassPrepare" to True on the execute task? That gets me every time I use variables.

If you don't set that, it treats the ? as a literal and fails.|||

Hi!

Yes, BypassPrepare is set to true...

Thank you!

|||Setup another variable to hold your full string so that in your SQL you only have the ? placeholder instead of ?/ASPNET.

So, in my test, I created a new variable, set its expression to concatenate the User::ServerName variable and the /ASPNET string. Set the new variable to EvaluateAsExpression and then use it in the parameter mapping of the ExecuteSQL task.

Does that do what you're looking for?|||

Hi!

I tried what you suggest and I still have the error... Then I tried something simpler, CREATE LOGIN ? WITH PASSWORD = 'lalala', and I got the following error:

Executing the query "CREATE LOGIN ? WITH PASSWORD = 'lalala'" failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

And if I change it to CREATE LOGIN test WITH PASSWORD = 'lalala' it works fine, so I guess it's not a connection problem. I guess I'm missing something silly!

Thank you!

|||What type of connection are you using? OLE DB, ADO, ADO.NET, ODBC, etc..

The connection type that you use will dictate how you name the parameter and then use a parameter in your SQL.|||http://sqljunkies.com/WebLog/knight_reign/archive/2005/10/05/17016.aspx|||

I'm using an OLE DB connection, and it seems the parameter name is ok... Posting the code would help?

Thank you!

|||I have a variable (User::Test) set as a string with a value of "P0160".

In the Execute SQL Task editor, my sql statement is:
update client set clientdesc = 'testing' where client = ?

Then, in the parameter mapping section, I added a variable and selected User::Test as the variable name. Its data type is VARCHAR. The Parameter Name is simply, 0.

That's it. I run the task and it works correctly.|||It works now. Thank you very much for you help!

Friday, March 9, 2012

Problem when moving index with included columns to another filegroup

Hi,

This may be a GUI bug. When I manually create and then execute a script to move an index with included columns to another filegroup, it works.

When I try to edit the storage property of the index through the GUI, index properties, then when I ask to generate the script for the change to the clipboard, I get an error

Could not add [FirstIncludedColumn] to the collection because it already exist. Microsoft.sqlserver.Smo

it works if the index does not includes addtl columns.

Is that a bug? It really looks it works when done manually.

Thanks, Philippe

Moving this thread to the Tools forum since this is not a TSQL/DDL issue.|||

This sounds like a bug to me. Please file a defect report here: http://lab.msdn.microsoft.com/productfeedback/Default.aspx

If possible, please include the T-SQL to create the index that causes problems. It also helps if you can include really detailed instructions for what you clicked/typed in the index dialog to make the storage change.

Thanks,
Steve