my program has to accomplish these tasks:
- Connect to a remote SQLServer database.
- Getting data of each table in the database, and each column of each table.
- With the data obtained write queries to create a copy of the database
Everything goes fine, but when i try to run the query on my DBMS (Microsoft SQL Server Management Studio) it returns errors with the last entry but everything goes fine if i run one single query. What am i doing wrong? Here's is a snippet of the result
IF NOT EXISTS (select * from dbo.sysobjects where id = object_id(N'[test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE dbo.test(
KeyId numeric(18, 0) PRIMARY KEY NOT NULL,
intNumTest numeric(18, 0) NULL,
intNumTest2 numeric(18, 0) NULL);
END
Imagine there are hundred of these kind of query, every single one running fine but returning errors if ran together