you tried to assign null value to a variable that is not a variant

  • Follow


OK, I'm pulling my hair out. I'm trying to append records to a table.
No code, just an append query.  When the table is in the same
database, it works fine.

But I need to update tables in a linked database. When I do that it
will say "you tried to assign null value to a variable that is not a
variant data type" about 80% of the time.

I really need the append query to work.

Help me! Please!

Thanks,
Laura
0
Reply musicloverlch 3/23/2011 7:46:40 PM

I just ran into this a few weeks ago. My problem was caused by nullable bit
fields in the remote sql server database. This rendered the table
essentially read-only. I had to change the table schema in the remote
database to solve this problem:

ALTER TABLE dbo.tablename
ADD CONSTRAINT df_bitcolname
DEFAULT 0  FOR bitcolname WITH VALUES
GO
ALTER TABLE dbo.tablename
ALTER COLUMN bitcolname BIT NOT null

Once I did this my problem was solved.

musicloverlch wrote:
> OK, I'm pulling my hair out. I'm trying to append records to a table.
> No code, just an append query.  When the table is in the same
> database, it works fine.
>
> But I need to update tables in a linked database. When I do that it
> will say "you tried to assign null value to a variable that is not a
> variant data type" about 80% of the time.
>
> I really need the append query to work.
>
> Help me! Please!
>
> Thanks,
> Laura


0
Reply Bob 3/23/2011 8:16:18 PM


Thanks Bob!

I'll try that!

On Mar 23, 3:16=A0pm, "Bob Barrows" <reb01...@NOyahooSPAM.com> wrote:
> I just ran into this a few weeks ago. My problem was caused by nullable b=
it
> fields in the remote sql server database. This rendered the table
> essentially read-only. I had to change the table schema in the remote
> database to solve this problem:
>
> ALTER TABLE dbo.tablename
> ADD CONSTRAINT df_bitcolname
> DEFAULT 0 =A0FOR bitcolname WITH VALUES
> GO
> ALTER TABLE dbo.tablename
> ALTER COLUMN bitcolname BIT NOT null
>
> Once I did this my problem was solved.
>
>
>
> musicloverlch wrote:
> > OK, I'm pulling my hair out. I'm trying to append records to a table.
> > No code, just an append query. =A0When the table is in the same
> > database, it works fine.
>
> > But I need to update tables in a linked database. When I do that it
> > will say "you tried to assign null value to a variable that is not a
> > variant data type" about 80% of the time.
>
> > I really need the append query to work.
>
> > Help me! Please!
>
> > Thanks,
> > Laura- Hide quoted text -
>
> - Show quoted text -

1
Reply musicloverlch 3/24/2011 2:47:05 PM

2 Replies
1330 Views

(page loaded in 0.001 seconds)

Similiar Articles:











7/19/2012 7:48:17 PM


Reply: