how to insert service data in compact database in wp8 - windows-phone-8

Iam caching the services using the database ,I am using sql server compact database (.sdf file) and copying database to isolated storage.There is a change in services so iam not able to cache it ,So how to manually insert services in.sdf file
CREATE TABLE [GenContents]
(
[Id] INT NOT NULL IDENTITY (1,1),
[ModuleUniqueName] NVARCHAR(4000) NOT NULL,
[ResponseContent] NTEXT,
[Category] NVARCHAR(4000) NOT NULL,
[Language] NVARCHAR(4000) NOT NULL,
[StoredTime] NVARCHAR(4000) NOT NULL
);
ALTER TABLE [GenContents] ADD CONSTRAINT [PK_GenContents] PRIMARY KEY ([Id]);

Related

How to Auto create db table in cloud sql when deploy spring boot application to gcp app engine

I want to create db table in mysql when deploy spring boot application to gcp.
Using below code:
Create a schema.sql file in resource folder
select 1 from dual;
Create a student.sql file in resource folder
which have all query for create table and insert command.
USE student;
create table student (
ID INT AUTO_INCREMENT PRIMARY KEY,
ENUMBER VARCHAR(50),
FIRSTSUBMITDATE datetime,
LASTSUBMITDATE datetime,
TIMEZONE VARCHAR(50),
SWCREATEDBY VARCHAR(50),
SWMODIFYBY VARCHAR(50)
);
application.property:
spring.datasource.platform=mysql
spring.datasource.data=classpath:student.sql
spring.datasource.initialization-mode=always
Not getting any error and not create my tables.
Try this in properties
spring.jpa.properties.javax.persistence.schema-generation.database.action= drop and create
spring.jpa.properties.javax.persistence.schema-generation.create-database-schemas=true
spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata

How to add id automatically in SAS

I have the following SAS code:
PROC SQL;
CREATE TABLE HUB_Addresses (
AddressID INT AUTO_INCREMENT,
LOAD_DATE NUM FORMAT=DATETIME22. NOT NULL,
RECORD_SOURCE VARCHAR(255) NOT NULL
);
RUN;
quit;
But AUTO_INCREMENT is not working. How can I fix it
You Can Add other columns and run.
CREATE TABLE `HUB_Addresses` (
`AddressID` INT NOT NULL AUTO_INCREMENT ,
PRIMARY KEY (`AddressID`))
ENGINE = MyISAM;
RDBMS features found in other systems, such as Oracle, SQL Server or Netezza:
auto_increment not in SAS SQL
triggers not in SAS SQL
default values not in SAS SQL
sequences not in SAS SQL
If your data design depends on auto_increment you will have to use a third party data base and the appropriate SAS/ACCESS engine to interact with it.
Proc SQL lacks the listed features because the default Base SAS library engine (V9) does not support such features.
If you already have a MySQL connection available and a SAS/ACCESS engine to interoperate:
SAS/ACCESS to MySQL or
SAS/ACCESS to ODBC with MySQL ODBC drivers installed
You can use pass-through syntax to submit MySQL statements directly to the data base server.
libname REMOTE MYSQL … connection options …;
PROC SQL;
connect using REMOTE;
execute (
/* MySQL statement */
CREATE TABLE HUB_Addresses (
AddressID INT AUTO_INCREMENT,
LOAD_DATE DATE NOT NULL,
RECORD_SOURCE VARCHAR(255) NOT NULL
)
by REMOTE;
* insertion occurs through SAS/ACCESS engine via REMOTE libref;
insert into REMOTE.HubAddresses
values (., '01FEB2010'D, 'Manual insert')
;

how to transfer from MySql to Management Studio

I have database which works on MySql. And i need to copy it to another computer where there is only management studio. i create .sql file from MySql and tried to run it in studio but always have syntax errors.
How to do it correctly?
CREATE TABLE branches (
idbranches int(11) NOT NULL AUTO_INCREMENT,
address varchar(200) NOT NULL,
e.g. incorrect syntax for "AUTO_INCREMENT"
The SQL Server syntax is:
CREATE TABLE branches (
idbranches int identity(1, 1) not null,
address varchar(200) NOT NULL
);

Could not locate entry in sysdatabases for database

I need this code to run the instant the professor hits the F5 button.
I created a database and I have a problem with the USE statement
SQL just can't switch to the database that USE statement is calling. it's saying this:
could not locate entry in sysdatabases for database
I tried with square brackets ([]) and it's not helping.
The project is about Car Service and its a school project.
I just need that USE statement to run or some other solution so the code can run without error and in one click on F5.
USE master;
IF DB_ID('ServisAutomobila') IS NOT NULL
DROP DATABASE ServisAutomobila;
GO
CREATE DATABASE ServisAutomobila;
USE ServisAutomobila
go
CREATE TABLE Automobil
(
Automobil_ID int identity (1,1) not null,
Model nvarchar (50) not null,
GodinaProizvodnje nvarchar(50) not null,
RegistarskiBroj nvarchar (50) unique not null,
BrojMotora nvarchar (50) unique not null,
BrojSasije nvarchar (50) unique not null,
Kvar nvarchar (250) not null,
TipAutomobila_ID int not null,
Zemlja_ID int not null,
Vlasnik_ID int not null
)
CREATE TABLE Zemlja
(
Zemlja_ID int identity (1,1) not null,
Zemlja nvarchar (50) not null
)
The GO keyword is a batch terminator. So in your example:
CREATE DATABASE ServisAutomobila;
USE ServisAutomobila
go
The batch is executed as one and results in that particular error because the database engine tries do use database ServisAutomobila which does not exists yet. This means that you must add that extra GO suggested in the previous comments before you can use the newly created database:
CREATE DATABASE ServisAutomobila;
GO;
USE ServisAutomobila;
GO;

SQL violation of primary key constraint replication

I'm trying to make a replication between an sql server 2008 to 2012
I have done that before between 2008 server and works perfectly
Now when I set the publication type to snapshot, and doing it as a push from the distributor to the subscriber I'm getting an error
Violation of PRIMARY KEY constraint 'PK__tableF__4EBD61D204E4BC85'. Cannot insert duplicate key in object 'dbo.table'. The duplicate key value is (0). (Source : MSSQLServer, Numéro d'erreur : 2627)
Obtenir de l'aide : http://help/2627
Even if I selected only one table to replicate I had always the same problem, the schema of the database is created but no data in the table
I tried to ressed the table and it doesn't work.
Please what can I do?
Thanks
I'm always with this problem
I tried to write a script instead of using the wisard
DECLARE #publication AS sysname;
DECLARE #subscriber AS sysname;
DECLARE #subscriptionDB AS sysname;
DECLARE #frequency_type as int;
DECLARE #subscriber_security_mode as int;
DECLARE #subscriber_login AS sysname;
DECLARE #subscriber_password AS sysname;
SET #publication = N'8-9' ;
SET #subscriber =N'APPLI-SERV-EXT';
SET #subscriptionDB = N'89' ;
SET #subscriber_security_mode= 1;
SET #subscriber_login=N'xxx';
SET #subscriber_password=N'xxxx';
--Add a push subscription to a transactional publication.
USE [DBName]
EXEC sp_addsubscription
#publication = #publication,
#subscriber = #subscriber,
#destination_db = #subscriptionDB,
#subscription_type = N'push';
EXEC sp_addpushsubscription_agent
#publication = #publication,
#subscriber = #subscriber,
#subscriber_db = #subscriptionDB,
#subscriber_security_mode=#subscriber_security_mode,
#subscriber_login=#subscriber_login,
#subscriber_password=#subscriber_password,
#frequency_type = #frequency_type,
#job_login = N'xxxx',
#job_password = N'xxx';
GO
when I execute I got a warning "Warning : the work of the distribution agent Was implicitly created and will run under the service account of the SQL Server Agent."
If I check the subscriber I found that the schema is replicated and instead to have a 418 row in the table I have 4012 and the table is empty except a not null attribute which is 0
here is the script of the table
USE [test]
GO
/****** Object: Table [dbo].[clientEssai] Script Date: 15/09/2015 15:13:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[clientEssai](
[client_id] [int] NOT NULL,
[client_name] [varchar](255) NULL,
[contact_name] [varchar](255) NULL,
[tel] [varchar](255) NULL,
[gsm] [varchar](255) NULL,
[email] [varchar](255) NULL,
[adress] [varchar](255) NULL,
[registration_date] [date] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
P.S: I selected only one article to replicate which is the table ClientEssai
Publisher and Distributor are the 2008 instance
subscriber 2012
I'm doing a push
and I'm using the same account for the agents
Is there a particular configuration to do?
Thank you