How to fix "com.microsoft.sqlserver.jdbc.SQLServerException: "UserID" is not a recognized table hints option."

Joseph 0 Reputation points
2024-03-22T05:19:01.1166667+00:00

I get this error whenever my application tried to access the azure database, it connects to the database just fine it's only when it tries to access the tables. This is the query i used to create the table:
-- Drop existing tables if they exist

IF OBJECT_ID('files', 'U') IS NOT NULL

DROP TABLE files;

-- Create 'files' table

CREATE TABLE files (

FileID int IDENTITY(1,1) PRIMARY KEY,

FileExtension varchar(255),

BlurHash varchar(255),

Status bit NOT NULL DEFAULT 0

);

-- Drop existing tables if they exist

IF OBJECT_ID('users', 'U') IS NOT NULL

DROP TABLE users;

-- Create 'users' table

CREATE TABLE users (

UserID int IDENTITY(1,1) PRIMARY KEY,

UserName varchar(255),

Password varchar(255)

);

-- Insert data into 'users' table

INSERT INTO users (UserName, Password) VALUES

('dara', '123'),

('raven', '123'),

('china', '123');

-- Drop existing tables if they exist

IF OBJECT_ID('user_account', 'U') IS NOT NULL

DROP TABLE user_account;

-- Create 'user_account' table

CREATE TABLE user_account (

UserID int PRIMARY KEY,

UserName varchar(255),

Gender varchar(10) DEFAULT '',

Image varbinary(max),

ImageString varchar(255) DEFAULT '',

Status bit NOT NULL DEFAULT 1,

CONSTRAINT FK_UserID FOREIGN KEY (UserID) REFERENCES users (UserID) ON DELETE CASCADE ON UPDATE CASCADE

);

-- Insert data into 'user_account' table

INSERT INTO user_account (UserID, UserName, Gender, Image, ImageString) VALUES

(1, 'dara', '', null, ''),

(2, 'raven', '', null, ''),

(3, 'china', '', null, '');

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. hossein jalilian 10,825 Reputation points Volunteer Moderator
    2024-03-25T00:47:59.7633333+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    if you're encountering errors when accessing these tables after connecting to the Azure SQL Database, it's possible that the issue lies elsewhere in your application code or in the way the tables are being accessed.

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.