• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

dsn connection

When i am using northwind database (built in when installed sql server) to create a recordset, it is ok.
But when i am using my own creation database to create a recordset, one dialog box come out showing:

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'User'.

I use the same driver in odbc when i create the DSN

I am using Sql server 7.0 and ultradev 4.0 with Windows2000 server.

Please help...
thank you
0
anwar13
Asked:
anwar13
  • 2
  • 2
  • 2
  • +1
1 Solution
 
anwar13Author Commented:
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'User'.

User here is the user table.
0
 
Eric AKA NetminderCommented:
Can you post your query?
0
 
anwar13Author Commented:
ALTER TABLE [dbo].[File] DROP CONSTRAINT FK_File_USER
GO

if exists (select * from sysobjects where id = object_id(N'[dbo].[USER]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[USER]
GO

if exists (select * from sysobjects where id = object_id(N'[dbo].[File]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[File]
GO

CREATE TABLE [dbo].[USER] (
     [UserID] [numeric](18, 0) NOT NULL ,
     [name] [varchar] (50) NOT NULL ,
     [password] [varchar] (50) NOT NULL ,
     [email] [varchar] (50) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[File] (
     [UserID] [numeric](18, 0) NOT NULL ,
     [FileID] [numeric](18, 0) NOT NULL ,
     [FileDesc] [varchar] (8000) NOT NULL ,
     [FileTitle] [varchar] (200) NOT NULL ,
     [FilePath] [varchar] (100) NOT NULL ,
     [FileDate] [datetime] NOT NULL
) ON [PRIMARY]
GO
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
Eric AKA NetminderCommented:
Looks to me like USER is being thought of as a keyword or reserved word...

Try changing the name of the USER table to something else, and see what happens...
0
 
dclaryCommented:
The only message I get with SQL 7.0 is

"The total row size (8353) for table 'File' exceeds the maximum number of bytes per row (8060). Rows that exceed the maximum number of bytes will not be added."

Hope that helps
0
 
PhilipT1999Commented:
I agree with dclary your create table is 8336 plus the length of the date. Which exceeds the max row size.  You have a fileDesc of 8000 (seems kinda large), just lower that until the total length is less that 8353 or break it out into a second table.
 
0
 
PhilipT1999Commented:
I meant lower it until the total length is below 8060 bytes.  Sorry about the typo.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now