Can't insert record with nvarchar(Max)

Category: sql server express

Question

Kenrav on Sat, 06 Oct 2018 18:18:06


I have no issue inserting the following:

strSQL = "INSERT INTO tblTrans (xGUID, TransDate, TransType, Note, PatientID, UserName) " & _
'"VALUES ('" & sGUID & "',#" & dtDateTime & "#,'Clinical Note','" & strNoteBB & "', '" & strDriverID & "','AutoUser')"

However, if I add the varChar(Max) field named "Note" to my statement, I get a 3134 Syntax Error. 

strSQL = "INSERT INTO tblTrans (xGUID, TransDate, TransType, Note, PatientID, UserName) " & _
'"VALUES ('" & sGUID & "',#" & dtDateTime & "#,'Clinical Note','This is a note'" & strDriverID & "','AutoUser')"

Any ideas?  Thanks.

Replies

Visakh16 on Sun, 07 Oct 2018 06:14:58


what is the error you're getting?

3134 Syntax Error looks very vague and doesnt look like T-SQL error

Are you sure your db is SQLServer?

this is SQLServer forum so if you're on any other RDBMS, you may better off posting this in relevant forums.

Kenrav on Sun, 07 Oct 2018 14:42:00


Visakh,

You raise a good point.  My app is a MS Access front-end linked to a SQL Server Express back-end.  The error message is most likely coming from MS Access.  I'll post in the Access forum and see if that helps.  Thanks!

Kenrav

Visakh16 on Fri, 12 Oct 2018 09:46:51


Visakh,

You raise a good point.  My app is a MS Access front-end linked to a SQL Server Express back-end.  The error message is most likely coming from MS Access.  I'll post in the Access forum and see if that helps.  Thanks!

Kenrav


Cool

That makes sense

Thanks Kenrav