Showing posts with label tables. Show all posts
Showing posts with label tables. Show all posts

Thursday, March 29, 2012

Error: duplicate key row

What might cause the following error when inserting rows in tables that have primary keys defined as IDENTITY (1,1)?

duplicate key row in object 'aa' with unique index 'aa'

I have seen this happen frequently when data has been bulk loaded sometime in the past into a table that has an IDENTITY key. This is especially common when you have a test environment in which some production data was bulk loaded to give some "good test data." To me it means that an identity number has "already been used" as a record key.


Dave

|||The rows are inserted one at a time using the parent IDENTITY key as a FK constraint in the child table which also has an IDENTITY KEY. However, this scenario does not sound like it would cause an error.|||

Can you post the table structures? That would help us to see what your problem might be.

If you can post a few statements that cause the duplicates, that would even be better.

|||

If you have the property NOT FOR REPLICATION enabled for the identity column.

Merging changes would allow the exact id values to be inserted rather than a new value that would give the error if same id value exists in the participating server.

similarly, if you are trying to insert manually using SET IDENTITY_INSERT table ON...

Tuesday, March 27, 2012

Error: Changed language to ...

When I try to open some tables in a database using QueryAnalyzer I receive
the following error:
"[Microsoft][ODBC SQL Server Driver][SQL Server]Changed language to
bulgarian".
And in result the table is not opened.
Bulgarian is my native language by the way.
I made the following experiment :
I created a new table with the same definition as one of the problem tables.
Then I inserted all records from the problem table in the new one. Then I
had no problems opening the new table using QueryAnalyzer.
Do you have any idea what the problem is?
Thank you!What language is SQL Server set to? And was it the same as to when you
created the table the first time?
Yovan
"ggeshev" <ggeshev@.tonegan.bg> wrote in message
news:eVajZeDeDHA.2324@.TK2MSFTNGP11.phx.gbl...
> When I try to open some tables in a database using QueryAnalyzer I receive
> the following error:
> "[Microsoft][ODBC SQL Server Driver][SQL Server]Changed language to
> bulgarian".
> And in result the table is not opened.
> Bulgarian is my native language by the way.
> I made the following experiment :
> I created a new table with the same definition as one of the problem
tables.
> Then I inserted all records from the problem table in the new one. Then I
> had no problems opening the new table using QueryAnalyzer.
> Do you have any idea what the problem is?
> Thank you!
>

Sunday, March 11, 2012

Error: [Microsoft][ODBC SQL Server Driver] Timeout Expired

I am getting above error msg when I tried to run my View.
The view have 12 tables and 20 joins, which tells you the complaxcity of
the view. When run this view using Query Analyzer it gave me the above
msg as well and then i update timeout property within QA. After
updating the timeout property, the view run fine. I need the same
changes in Enterprise Manager and update timeout property for the server
but it still not working.
Help!
Many Thanks
*** Sent via Developersdex http://www.codecomments.com ***Hi
Do you have appropriate indexes on the tables involved, especially on the
columns used for the joins?
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Syed" wrote:

> I am getting above error msg when I tried to run my View.
> The view have 12 tables and 20 joins, which tells you the complaxcity of
> the view. When run this view using Query Analyzer it gave me the above
> msg as well and then i update timeout property within QA. After
> updating the timeout property, the view run fine. I need the same
> changes in Enterprise Manager and update timeout property for the server
> but it still not working.
> Help!
> Many Thanks
>
> *** Sent via Developersdex http://www.codecomments.com ***
>

Error: [Microsoft][ODBC SQL Server Driver] Timeout Expired

I am getting above error msg when I tried to run my View.
The view have 12 tables and 20 joins, which tells you the complaxcity of
the view. When run this view using Query Analyzer it gave me the above
msg as well and then i update timeout property within QA. After
updating the timeout property, the view run fine. I need the same
changes in Enterprise Manager and update timeout property for the server
but it still not working.
Help!
Many Thanks
*** Sent via Developersdex http://www.developersdex.com ***Hi
Do you have appropriate indexes on the tables involved, especially on the
columns used for the joins?
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Syed" wrote:
> I am getting above error msg when I tried to run my View.
> The view have 12 tables and 20 joins, which tells you the complaxcity of
> the view. When run this view using Query Analyzer it gave me the above
> msg as well and then i update timeout property within QA. After
> updating the timeout property, the view run fine. I need the same
> changes in Enterprise Manager and update timeout property for the server
> but it still not working.
> Help!
> Many Thanks
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

Error: [Microsoft][ODBC SQL Server Driver] Timeout Expired

I am getting above error msg when I tried to run my View.
The view have 12 tables and 20 joins, which tells you the complaxcity of
the view. When run this view using Query Analyzer it gave me the above
msg as well and then i update timeout property within QA. After
updating the timeout property, the view run fine. I need the same
changes in Enterprise Manager and update timeout property for the server
but it still not working.
Help!
Many Thanks
*** Sent via Developersdex http://www.codecomments.com ***
Hi
Do you have appropriate indexes on the tables involved, especially on the
columns used for the joins?
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Syed" wrote:

> I am getting above error msg when I tried to run my View.
> The view have 12 tables and 20 joins, which tells you the complaxcity of
> the view. When run this view using Query Analyzer it gave me the above
> msg as well and then i update timeout property within QA. After
> updating the timeout property, the view run fine. I need the same
> changes in Enterprise Manager and update timeout property for the server
> but it still not working.
> Help!
> Many Thanks
>
> *** Sent via Developersdex http://www.codecomments.com ***
>

Wednesday, March 7, 2012

error with sp_tables_ex

Hi all,

I am using a sp for show the external tables in a linked server ABC which via Ole DB for Visual Foxpro.
sp_tables_ex ABC
It returns error,
Msg 7399, Level 16, State 1, Procedure sp_tables_ex, Line 41
The OLE DB provider "SQL Server" for linked server "(null)" reported an error. The provider reported an unexpected catastrophic failure.
Msg 7311, Level 16, State 2, Procedure sp_tables_ex, Line 41
Cannot obtain the schema rowset "DBSCHEMA_TABLES" for OLE DB provider "SQL Server" for linked server "(null)". The provider supports the interface, but returns a failure code when it is used.

When I used the same command to other linked server(with ole DB VFP also but with different path). And I tried 'select * from openquery(ABC, 'select * from product')'. Both work fine.

Kindly advise. Thanks in advance.

Hi Stephanie,

Are you by any chance running into the problem described in this KB article:

FIX: OLE DB Provider Improperly Enumerates DBSCHEMA_TABLES
http://support.microsoft.com/kb/314888

HTH,

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

Error with schedule a DTS package...

Hi experts...

I'm trying to schedule a DTS package (import some tables from Mysql database) but there is
an error and I don't know how to resolve it.

The error is always the same...
"The job failed. The Job was invoked by Schedule 24 (Import RT data). The last step to run was step 1 (Import RT data)."

I have tried changing the all the parameters in the job properties, but I always obtein the same message.

The DTS package works fine, I can execute and it works, the problem is the schedule...

Thanks in advanced...What account is the scheduled task running under? Normally if you run it yourself and it works, you are running the DTS package with YOUR permissions. However, if you run the DTS package under a schedule, it is using the standard SQL Server account (which is either Local System or another specified account). You need to change the account the schedule runs under to have enough permissions to run properly.|||Thanks for your reply...

I have one more question... How can i change the account of the schedule task?... I don't know how can I change it.

The strange thing is that I've done the same with another databases, only one thing is different, the source, the schedules that work fine are between SQL databases and this is from Mysql to sql database... but this is not the problem becouse as I said I can execute it and it works fine.

thanks again.|||If you schedule a job in SQL Server, then on the Job Properties dialog window, click the Steps tab. Highlight the step (here, executing the DTS package job) that you want, and click Edit or properties. In the Job Step properties dialog window, click the Advanced tab, and there is a Run as user dropdownlist. Try changing that to your credentials.|||Hi Again,

There is a problem with this solution... the step type is CmdExec and you can't see this option unless you choose SQL Script type... I don't understand what's happening, I have read the documentation about Package Scheduling and Security Issues but I don't know how to change who invoked the job...

thanks again...|||That's an operating-system command or executable program command step. I'm not familiar with that. Is there any way to change the security context in the DTS package designer?|||Hi again...

The step is an operating system command... but as I said this job is similar to other... the only I can see related to the security context is the owner, and it's the same in all jobs that I have done (and they work fine).

thanks for your interest.|||Aha, I found this from databasejournal.com (link

You can also schedule execution of DTS packages using SQL Server Agent jobs. This ability is granted by default to the public group, based on permissions to execute sp_add_job and sp_add_jobschedule stored procedures in the MSDB database (this applies to all SQL Server Agent jobs, not just the ones that invoke DTS packages). Typically, it is recommended to restrict access to them to a limited number of privileged logins. While jobs typically execute in the security contexts of their owner, in the case of DTS packages this might be different. The reason is the fact that a task that contains invocation of a DTS package accomplishes this by the running DTSRun command line utility, which involves, in turn, the use of CmdExec. If you limit permissions to launch CmdExec jobs to members of the SysAdmin fixed server role (which is the default behavior), jobs will still execute in the same security context as their owners. However, you can change this default in the SQL Server Agent Properties dialog box, accessible by selecting the Properties option from the SQL Server Agent node under the Management folder in the SQL Server Enterprise Manager console. In the Job System tab, you need to clear the checkbox next to the "Only users with SysAdmin privileges can execute CmdExec and ActiveScripting job steps" and provide a Proxy Account name and password. The proxy account provides the security context for execution of DTS packages, so ensure that it has access to all relevant data stores, file system paths or COM components, which might be used by ActiveX scripting tasks. Remember, however, that at the same time you allow users without SysAdmin privileges to run potentially dangerous ActiveScripting jobs.|||Thanks a lot, but I haven't resolved the problem, I have seen this choice, and I put an administration user, but It didn't work... I don't know...

Sorry about your lost time.|||An administrative user for the box, or an administrative user on the domain? Domain permissions could be the problem.

You could also try posting to the Microsoft newsgroups, specifically the sqlserver.dts one:

http://communities.microsoft.com/newsgroups/default.asp

Then look for sqlserver.dts in the left frame after it downloads (it takes a while).

Error with Linked Servers

From time to time the linked servers we have set up cannot be accessed. When
I click on the tables node under the linked server within enterprise manager
the session hangs and no error message is displayed. When querying the data
via an openquery no error is thrown, the query simply runs until manually
aborted.
I've created a linked server OK but immediately cannot open it. The only way
around this problem we have is a reboot of the server. Does anyone know how
to resolve this problem and also what would cause this.
Thanks
MikeMikeD
Do you have ping to linked server?
"MikeD" <MikeD@.discussions.microsoft.com> wrote in message
news:ACBEC816-1EE1-46E8-9535-8E52BB7C502A@.microsoft.com...
> From time to time the linked servers we have set up cannot be accessed.
> When
> I click on the tables node under the linked server within enterprise
> manager
> the session hangs and no error message is displayed. When querying the
> data
> via an openquery no error is thrown, the query simply runs until manually
> aborted.
> I've created a linked server OK but immediately cannot open it. The only
> way
> around this problem we have is a reboot of the server. Does anyone know
> how
> to resolve this problem and also what would cause this.
> Thanks
> Mike|||I can ping the server that sql is on if that's what you mean. I can see and
create linked servers but cannot query them - see below.
"Uri Dimant" wrote:

> MikeD
> Do you have ping to linked server?
> "MikeD" <MikeD@.discussions.microsoft.com> wrote in message
> news:ACBEC816-1EE1-46E8-9535-8E52BB7C502A@.microsoft.com...
>
>|||MikeD
Do you run the query in this way?
SELECT <> FROM Server.dbname.dbo.table
"MikeD" <MikeD@.discussions.microsoft.com> wrote in message
news:2C11B49F-D1BF-48C2-9ECC-2470666F9691@.microsoft.com...[vbcol=seagreen]
>I can ping the server that sql is on if that's what you mean. I can see and
> create linked servers but cannot query them - see below.
> "Uri Dimant" wrote:
>|||No - it's an openquery so it's :
SELECT * FROM OPENQUERY[linked_server_name], 'Select * from table_name'
But the problem isn't so much in the query it's the fact that when you
select the linked server the system hangs with no error message and the only
way we have of resolving the issue is a server reboot
"Uri Dimant" wrote:

> MikeD
> Do you run the query in this way?
> SELECT <> FROM Server.dbname.dbo.table
>
>
> "MikeD" <MikeD@.discussions.microsoft.com> wrote in message
> news:2C11B49F-D1BF-48C2-9ECC-2470666F9691@.microsoft.com...
>
>|||Well, is it large set data you want to return?
exec sp_serveroption 'servername','data access','true'
"MikeD" <MikeD@.discussions.microsoft.com> wrote in message
news:6EA13818-E61B-49E7-B6E0-35F581ADAF0F@.microsoft.com...[vbcol=seagreen]
> No - it's an openquery so it's :
> SELECT * FROM OPENQUERY[linked_server_name], 'Select * from table_name
'
> But the problem isn't so much in the query it's the fact that when you
> select the linked server the system hangs with no error message and the
> only
> way we have of resolving the issue is a server reboot
> "Uri Dimant" wrote:
>|||It's nothing to do with the query or the size of data. the problem is that
the linked server cannot be accessed until a reboot is done.
"Uri Dimant" wrote:

> Well, is it large set data you want to return?
> exec sp_serveroption 'servername','data access','true'
>
> "MikeD" <MikeD@.discussions.microsoft.com> wrote in message
> news:6EA13818-E61B-49E7-B6E0-35F581ADAF0F@.microsoft.com...
>
>

Friday, February 24, 2012

Error while updating INDEXES

I was updating few indexes in one of my database tables when I got this warning message:
"Warning! The maximum key length is 900 bytes. The index 'IX_cc_statusText' has maximum length of 1024 bytes. For some combination of large values, the insert/update operation will fail."

Can anyone help me out as to:
1. Why this warning was thrown?
2. What are the implications of the same?
3. How to rectify this?

Here is the script I was using to update the indexes:

CREATE INDEX [cc_programEnrollment14] ON [dbo].[cc_programEnrollment]([cc_company_uid]) ON [PRIMARY]
GO

CREATE INDEX [IX_cc_program_uid] ON [dbo].[cc_programEnrollment]([cc_program_uid]) ON [PRIMARY]
GO

CREATE INDEX [IX_cc_status_uid] ON [dbo].[cc_programEnrollment]([cc_status_uid]) ON [PRIMARY]
GO

CREATE INDEX [IX_cc_CompanyID] ON [dbo].[cc_programEnrollment]([cc_CompanyID]) ON [PRIMARY]
GO

CREATE INDEX [IX_cc_statusText] ON [dbo].[cc_programEnrollment]([cc_statusText]) ON [PRIMARY]
GO

CREATE INDEX [IX_cc_initiatedDate] ON [dbo].[cc_programEnrollment]([cc_initiatedDate]) ON [PRIMARY]
GO

CREATE INDEX [IX_cc_initiatedBy_uid] ON [dbo].[cc_programEnrollment]([cc_initiatedBy_uid]) ON [PRIMARY]
GO

CREATE INDEX [IX_cc_SponsorID] ON [dbo].[cc_programEnrollment]([cc_SponsorID]) ON [PRIMARY]
GO

CREATE INDEX [IX_cc_SponsorDistributor_uid] ON [dbo].[cc_programEnrollment]([cc_SponsorDistributor_uid]) ON [PRIMARY]
GO

CREATE INDEX [IX_cc_programEnrollment] ON [dbo].[cc_programEnrollment]([cc_isDealerEligible], [cc_uid]) ON [PRIMARY]
GO

Thanks in advance
DexterHey Dexy,

you're index creation is failing because your column cc_statusText is longer than 900 bytes. You should try and create your indexes on the smaller columns, as I'm quite positive larger columns will take a bit longer to look up in the index.

Have a look here...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8_ar_da_0ldf.asp

Regards,
-Kilka

Sunday, February 19, 2012

Error while Quering Qracle table from SQL 2000

Hi All

i am receiving following error while querying a particular table in Oracle form SQl 2000.
Other tables can be queried.

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDAORA' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'MSDAORA' ICommandPrepare::Prepare returned 0x80004005: The provider did not give any information about the error.].

Someone coould please guide me as to how to resolve this error?

Regrads,
YogeetaYOUR QUESTION IS NOT CLEAR .

Please try to post your question clearly and pass few more informations regarding your problem.|||

Quote:

Originally Posted by debasisdas

YOUR QUESTION IS NOT CLEAR .

Please try to post your question clearly and pass few more informations regarding your problem.


A user is accessing one particular Oracle table from SQL2005.For a particular table while running a simple sekect query he gets the following error message.
The other tables can be queried from the connected server in MS SQL.

Error Received:

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDAORA' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'MSDAORA' ICommandPrepare::Prepare returned 0x80004005: The provider did not give any information about the error.].

I hope now its clear and can enlighten me on this.

Regards

Friday, February 17, 2012

error while inserting data in to sql thru procedure

Dear all,
I am using the procedure for inserting data in to my tables.
when i try to inserting large lenght data the follwing error is comming
"Server: Msg 103, Level 15, State 7, Line 1
The identifier that starts with '7,'ppppppdd','asdf','asdf',1,
1,1,'asdf','f','asd','asdf','asdf','a
sd','NA','asdasdf','asd','asasdf','a
sdf','asdf','asdfa','a' is too long. Maximum length is 128."
how can i input the data more thatn128
please help me I am new in sql
@.tblName varchar(100), @.sqlstring varCHAR(5000)
AS
declare @.insertqry varchar(5000)
set @.insertqry='insert into '+ @.tblname + ' values (' + @.sqlstring +
',GETDATE())'
EXEC(@.insertqry)
Regards
lalWhy are you using dynamic SQL to insert data from an SP? I strongly
recommend you use a separate SP for each table and just pass the column
data as parameters. Use a static INSERT statement and use default
values if you need to support optional data.
Without seeing the full code or anything that reproduces the problem it
looks like you must have either a mismatched number of quotes or a
double-quoted string in your @.sqlstring with the QUOTED_IDENTIFIER
option set ON. Print out the @.sqlstring value, then paste it into Query
Analyzer to find the problem.
David Portas
SQL Server MVP
--

Wednesday, February 15, 2012

Error while doing DTS from INFORMIX to MSSQL

Dear All,

I'm using the DTS to transfer data from Informix 7.30 UC9 to MS SQL 2000 Enterprise. The tables I'm transferring contains data for BaaN ERP.

While transferring certain tables, I am successful. On some, I get an error that says "Data overflow". It was caused by "DBTYPE_DBTIMESTAMP".

Any idea why this happens?

Thanks!I have seen it caused many of times in my experience with data conversion. It is generally caused when a date is incorrect.

BOL confirms Infomix information:
The Informix ODBC driver is not supported for use with DTS.
The Merant Informix OLE DB provider is supported for DTS imports from Informix, but not DTS exports to Informix. This driver also cannot be used to import meta data.

The Intersolv Informix ODBC driver is supported, but with the following restrictions:
BLOBs cannot be exported to Informix.

When creating new tables on Informix, the DTS Import/Export Wizard will incorrectly map the SQL Server 2000 datetime columns to the Informix 'Datetime year to fraction' data type. Manually change this to the Informix Date type.

The DTS meta data import will not import Informix catalog or table information.|||Thanks for such a speedy reply!

I've heard about this "Merant OLE driver" but I can't seem to download it from anywhere. Any clues?

Thanks again!

Originally posted by Satya
I have seen it caused many of times in my experience with data conversion. It is generally caused when a date is incorrect.

BOL confirms Infomix information:
The Informix ODBC driver is not supported for use with DTS.
The Merant Informix OLE DB provider is supported for DTS imports from Informix, but not DTS exports to Informix. This driver also cannot be used to import meta data.

The Intersolv Informix ODBC driver is supported, but with the following restrictions:
BLOBs cannot be exported to Informix.

When creating new tables on Informix, the DTS Import/Export Wizard will incorrectly map the SQL Server 2000 datetime columns to the Informix 'Datetime year to fraction' data type. Manually change this to the Informix Date type.

The DTS meta data import will not import Informix catalog or table information.