Wolfgang Knauf
Nov 28, 2016 4:32:51 AM

"Generate CREATE TABLE statement" in WinSQL 10 does not work for SQLServer

Hi,

I evaluate WinSQL 10 to check whether it fixes an issue with the "Generate CREATE TABLE statement" functionality of our WinSQL 7 version ("nvarchar" columns are not supported).

But this feature does not work at all in the standalone "WinSQLRaw" version. No matter whether I use 32 or 64 bit version, I only see this error message:

Kein schließendes Anführungszeichen nach der Zeichenfolge ''.
Falsche Syntax in der Nähe von ''.
Falsche Syntax in der Nähe von ' + CHAR(13) + CHAR(10), -2
UNION
select '.
Falsche Syntax in der Nähe von ', -1
UNION
select  CAST( CASE s.colorder WHEN 1 THEN '.
'CREATE DEFAULT' muss die erste Anweisung in einem Abfragebatch sein.
Die @objectId-Skalarvariable muss deklariert werden.
Kein schließendes Anführungszeichen nach der Zeichenfolge ''.
Falsche Syntax in der Nähe von ''.
Kein schließendes Anführungszeichen nach der Zeichenfolge ' + CHAR(13) + CHAR(10)

'.
ALTER TABLE [dbo].[APP_Config] WITH NOCHECK
    ADD CONSTRAINT [APP_Config_PK]
    PRIMARY KEY (KeyName, GueltigAb)
    ON [PRIMARY]

Kein schließendes Anführungszeichen nach der Zeichenfolge ''.
Falsche Syntax in der Nähe von ''.
Falsche Syntax in der Nähe von ' + CHAR(13) + CHAR(10)


DECLARE @pkConstraint varchar(2000)
DECLARE @userName varchar(128), @tableName varchar(128),
@f'.
Kein schließendes Anführungszeichen nach der Zeichenfolge ' + CHAR(13) + CHAR(10)
END
CLOSE constCursor
DEALLOCATE constCursor

'.
Kein schließendes Anführungszeichen nach der Zeichenfolge ''.
Falsche Syntax in der Nähe von ''.
Falsche Syntax in der Nähe von '
from syscomments cv, sysdepends de, sysobjects tb, sysobjects dt
where tb.name = @tableName
and cv.id = de.id
and tb'.
Kein schließendes Anführungszeichen nach der Zeichenfolge ''.

 

Is this a problem when using the standalone (not installed version)? On my machine, an instance of WinSQL 7 is installed.

 

Best regards

 

Wolfgang



Synametrics support engineer
Nov 30, 2016 10:58:20 AM

No subject

Wolfgang,

What version of SQL Server are you using?

There are two ways to generate the "CREATE TABLE" statement in WinSQL: with or without the plugin. The error you are running into is related to Plugin. See if the version without plugin works for you. Here are the steps:

  • Locate the table in the catalog view
  • Right click to bring up the popup menu
  • Hold the SHIFT key before clicking on the Generate CREATE TABLE statement... menu item
  • When this this menu item is selected with SHIFT key pressed, it will use the method without plugin.

Let me know what happens.

Imran



Wolfgang Knauf
Dec 1, 2016 3:16:16 AM

No subject

I deinstalled WinSQL 7 on my machine. Still no improvement. But then I removed the directory "C:\Users\USERNAME\AppData\Roaming\WinSQL", and afterwards it worked.

I also noticed that our issue with WinSQL 7 ("nvarchar" datatype did not work) is fixed.

 

Just for the records: "Shift + click" also worked in the initial situation. This is the output:

 

-- Object: Table: dbo.APP_Config - Script date: 01.12.2016 08:56:25
CREATE TABLE dbo.APP_Config (
    KeyName varchar(254) NOT NULL,
    GueltigAb datetime NOT NULL,
    ValueText varchar(4000),
    Type varchar(100),
    Bemerkung nvarchar(1000)
)
;
-- Primary key
ALTER TABLE dbo.APP_Config ADD PRIMARY KEY (KeyName, GueltigAb)
;

 

Best regards

 

Wolfgang



Wolfgang Knauf
Dec 1, 2016 4:54:17 AM

No subject

Just one more detail to "finalize" this thread: the "create table" in WinSQL 7 seems to fail only for SQLServer 2014, but not for previous versions. So my assumption that it would be related to the "nvarchar" columns was wrong.

 

Best regards

 

Wolfgang



Wolfgang Knauf
Dec 7, 2016 5:09:17 AM

No subject

Hi,

I think I found the setting which causes this trouble: it seems to depend on the settings. I can reproduce the error on a MSSQL 2008 or MSSQL 2014 database with those modified settings:

"Query terminator string": semicolon (";") instead of "go"

"Terminators must be on a new line": unchecked (default is checked)

"Terminator must be the last character on line": unchecked (default is checked).

The latter setting seems to cause the error on "Create table" command.

 

Best regards

 

Wolfgang

Navigation

Social Media

Powered by 10MinutesWeb.com