Showing posts with label statement. Show all posts
Showing posts with label statement. Show all posts

Monday, March 19, 2012

ODBC Call Fail/Record locked

I have recently moved some native Access tables to SQL Server 7. These tables are updated in code. When the update is done via a SQL statement, I get
"This record is being modified by another user. . . Save, Copy to Clipboard, Drop Changes"

When the record is being updated via DAO code, I get,
"ODBC Call Fail"

Both errors are most irritating and I desperately need to find a way around this. Any suggestions would be greatly appreciated.

CrystalHi there,

Maybe this information helps you on the way...

-- Microsoft Knowledge Base Article - 128809

-- Zoek in de Google nieuwsgroepen naar Onderwerp:
"auto_increment fields and #Deleted in MS Access?"
Nieuwsgroep:
-> mailing.database.myodbc

Greetz,
DePrins
:)

Friday, February 24, 2012

Obtain a list of all rows insert via a select statement

With Table A being the parent table and having an identity column as the
primary key.
With Table B being a child of table A
I need to do an insert based on a select statement (multiple row returned)
in Table A. Then I need to insert multiple child rows in Table B for every
row inserted in Table A.
What is the best strategy? Is there a way to have a list of all the rows
inserted?
I'm open to any suggestion.
Thank you in advance
MartinYou can access those within a trigger, and have it populate a temp table
that the calling batch created, if such a temp table exists, e.g.,
create table t(k int not null identity primary key, d varchar(10));
go
create trigger trg_i_t on t for insert
as
if object_id('tempdb..#t') is not null
insert into #t select k from inserted;
go
-- test
create table #t(k int);
insert into t(d)
select 'a'
union all select 'b'
union all select 'c';
select * from #t;
drop table #t;
-- Output:
k
--
4
5
6
In SQL Server 2005 it will be much easier with the DML with results
enhancements.
Cheers,
--
BG, SQL Server MVP
www.SolidQualityLearning.com
"Martin Rajotte" <MartinRajotte@.discussions.microsoft.com> wrote in message
news:35F4A835-AC48-4896-B535-B550A768CF74@.microsoft.com...
> With Table A being the parent table and having an identity column as the
> primary key.
> With Table B being a child of table A
> I need to do an insert based on a select statement (multiple row returned)
> in Table A. Then I need to insert multiple child rows in Table B for every
> row inserted in Table A.
> What is the best strategy? Is there a way to have a list of all the rows
> inserted?
> I'm open to any suggestion.
> Thank you in advance
> Martin|||On Tue, 22 Mar 2005 15:51:02 -0800, Martin Rajotte wrote:

>With Table A being the parent table and having an identity column as the
>primary key.
>With Table B being a child of table A
>I need to do an insert based on a select statement (multiple row returned)
>in Table A. Then I need to insert multiple child rows in Table B for every
>row inserted in Table A.
>What is the best strategy? Is there a way to have a list of all the rows
>inserted?
>I'm open to any suggestion.
>Thank you in advance
>Martin
Hi Martin,
I'm not entirely sure if I understand you. Do you mean that you have
some data in one or more tables that needs to be inserted in two new
tables, where the second table links to the identity column of the
first?
The proper way to find the identity value of inserted rows after a
multirow insert is to query the table with the natural key as search
argument. That should return you the identity values.
If you need more specific advise, then please code DDL, sample data and
desired results. Check out www.aspfaq.com/5006.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

Monday, February 20, 2012

Objects cannot be created by using Transact-SQL statement

I can create a database or table or schema by using the (right click) context menu. This method is successful.

When I use the Transact-SQL statement (query window) to create an object, after being executed the reply is: command(s) completed successfully. However, the object does not get created.

Has anyone else had this issue? Any ideas?

We are using the MSSQL 2005 Enterprise server eval edition.

Thanks for your help.

Did you try to create an object in the schema and check again ? :-)

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||Please check the Database name (Available Database - Combobox), it may creates your object on some other (or on default) database..|||Where did you create the object? What was your selected database when you ran the script?

Also, Enterprise Mgr doesn't refresh the screen. You need to refresh the screen to get new objects to show up.|||

Tom Phillips wrote:

Where did you create the object? What was your selected database when you ran the script?

Also, Enterprise Mgr doesn't refresh the screen. You need to refresh the screen to get new objects to show up.

Just to add, simply highlight the database in a management suite, right click it and choose refresh... if you have created a stored procedure or a view, highlighting the appropriate node and right clicking, choosing refresh does a good job also.

hth
Barry|||

Thank you for all responses. My problem was resolved. I realized that I had to add a local user to my server before creating the new user in MS SQL Server. After that I could grant the permission to the database. Now everything is working smoothly.

Thanks again,

Yui