Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9095761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:41:11+00:00 2026-06-16T23:41:11+00:00

I am using webdb for client side and I want to match the server

  • 0

I am using webdb for client side and I want to match the server side database so the web app can be used offline. This here is the script for creating the server side table…

USE [TESTDB]
GO

/****** Object:  Table [dbo].[tblInternalMobile_SalesCalls]    Script Date: 01/08/2013 11:30:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[tblInternalMobile_SalesCalls](
    [newcall_id] [int] IDENTITY(1,1) NOT NULL,
    [companyname] [varchar](30) NOT NULL,
    [comment] [varchar](300) NULL,
    [dateUTC] [datetime2](7) NOT NULL,
 CONSTRAINT [PK_tblInternalMobile_SalesCalls] PRIMARY KEY CLUSTERED 
(
    [newcall_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

I am trying to match that on the client side but around identity I get an error Uncaught Error: [object SQLError], Error Code: 5, Error Message: could not prepare statement (1 near "IDENTITY": syntax error)

This is my client side code…

//Database helper
//I want to use a 'namespace' for this to minimize name conflicts
var DbHelper = {};
//use the webDb 'namespace' so we could use indexDb if need be in the future by making a new 'namespace'
DbHelper.webDb = {};
//To store the database object
DbHelper.webDb.db = null;
//Open the database
DbHelper.webDb.openDb = function() {
    var dbSize = 5 * 1024 * 1024 //5MB I believe is the max
    DbHelper.webDb.db = openDatabase("TestDB", "1.0", "Database manager", 5 * 1024 * 1024);
};
//If there is an error its going to throw an error, I havent added any handlers for this, so it should be added where the function is called
DbHelper.webDb.onError = function(tx, e) {
    throw "Error: " + e + ", Error Code: " + e.code + ", Error Message: " + e.message;
};
//This should be used if we are doing a non query, where we dont need to use the result
DbHelper.webDb.onSuccess = function(tx, r) {
    console.log("Database result: " + r)
};
//Create the tables we are going to use
DbHelper.webDb.createTables = function() {
    var db = DbHelper.webDb.db;
    db.transaction(function(tx) {
        //I am using the same tables as I am on the server, so we dont confuse things
        tx.executeSql("CREATE TABLE IF NOT EXISTS tblInternalMobile_SalesCalls(newcall_id INT PRIMARY KEY IDENTITY(1,1), companyname varchar(30), comment varchar(300), dateUTC DATETIME2)", [], DbHelper.webDb.onSuccess, DbHelper.webDb.onError);
    });
}
DbHelper.webDb.init = function() {
    DbHelper.webDb.openDb();
    DbHelper.webDb.createTables();
}

$(document).ready(function(e) {
    DbHelper.webDb.init();
});

Why the heck isn’t it working? I believe I am using the right syntax, obviously not.

The problem is this statement CREATE TABLE IF NOT EXISTS tblInternalMobile_SalesCalls(newcall_id INT PRIMARY KEY IDENTITY(1,1), companyname varchar(30), comment varchar(300), dateUTC DATETIME2)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T23:41:13+00:00Added an answer on June 16, 2026 at 11:41 pm

    If you’re actually using SQL Server or one of its variants on the client side as well as on the server side, you should probably use the same CREATE TABLE statement. But SQL Server doesn’t support CREATE TABLE IF NOT EXISTS.

    If you’re using the deprecated HTML5 interface, your user agent is expected to conform to SQLite syntax.

    CREATE TABLE tblInternalMobile_SalesCalls(
      newcall_id INTEGER PRIMARY KEY AUTOINCREMENT, 
      companyname varchar(30), 
      comment varchar(300), 
      dateUTC DATETIME2
    );
    

    I believe w3.org’s Indexed Database API is intended to supersede webdb.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I'm using a client-side database like Google Gears or a WebDB implementation, what's
using this code: Java Server side: ... out = new PrintWriter(this.client.getOutputStream(), true); ... public
Using server-side C#, how can I convert a querystring to a JSON string of
I'm playing around with writing a web app. In this case, I'm using scotty
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using range() in Underscore I can make something like this: _.range(10); >> [0, 1,
Using Tsql, how can I find out when MS SQL server was installed?
I'm developing a project in Server Side Javascript (SJS) using POW webserver. The result
Using HTML 5, I want to play multiple sounds simultaneously. how can I do
I am using the local database in web kit browsers and to get the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.