Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 DB error 102, Incorrect syntax near...

Author  Topic 

Lesley249
Starting Member

11 Posts

Posted - 2010-11-10 : 03:41:07
Hi All,

Can someone help me?
I have japan collation DB and I run below statement to call a stored procedure from VB application,

EXECUTE CSCreateColumn 'Items','CSbbb','char(8) NULL','','???',0,1,8,1,0,0

I got the error as below,
Execute CUSTOMSOLUTIONS.SQL Failed: (-2147221503: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'umns'.

BUT when i run that with query analyzer it is ok and using the profiler to capture the query it return

EXECUTE CSCreateColumn 'Items','CSaaa','char(8) NULL','','????',0,1,8,1,0,0
umns <---extra characters return

Anyone know where the extra character come from ?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-10 : 03:45:11
It looks like you have a problem in your VB code.
But we can't see...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-11-10 : 04:10:03
Post the code of CSCreateColumn.

PBUH

Go to Top of Page

Lesley249
Starting Member

11 Posts

Posted - 2010-11-10 : 05:11:36
quote:
Originally posted by Sachin.Nand

Post the code of CSCreateColumn.

PBUH






IF OBJECT_ID('dbo.CSCreateColumn') IS NOT NULL DROP PROCEDURE dbo.CSCreateColumn
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
CREATE PROC dbo.CSCreateColumn(@TableName char(30), @ColumnName varchar(60), @Parameter varchar(100), @Default varchar(30), @Description varchar(100), @TermID int, @DimType bigint, @Length int, @Dimensions int, @Scale int, @Flags int) AS
DECLARE @SeqNr int
DECLARE @Counter int
DECLARE @DimColumnName varchar(60)
SET @Counter = 0
SET @DimColumnName = @ColumnName
IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = @TableName) BEGIN
EXEC('CREATE TABLE dbo.' + @TableName + '(' + @DimColumnName + ' ' + @Parameter + ' ' + @Default + ')')
END
WHILE @Counter < @Dimensions BEGIN
IF @Dimensions > 1 BEGIN
SET @DimColumnName = @ColumnName + '_' + CONVERT(char(2), @Counter)
END
IF NOT EXISTS (SELECT ID FROM syscolumns WHERE ID = OBJECT_ID(@TableName) AND name = @DimColumnName) BEGIN
EXEC('ALTER TABLE ' + @TableName + ' ADD ' + @DimColumnName + ' ' + @Parameter + ' ' + @Default + '')
END ELSE BEGIN
IF NOT @ColumnName = 'sysguid' AND NOT @Parameter = 'TEXT NULL' AND NOT @ColumnName = 'ID' AND NOT (@DimType & 255) = 44 BEGIN
EXEC('ALTER TABLE ' + @TableName + ' ALTER COLUMN ' + @DimColumnName + ' ' + @Parameter + '')
END
END
SET @Counter = @Counter + 1
END
IF EXISTS (SELECT TableName FROM DDColumns WHERE TableName = @TableName) BEGIN
SELECT @SeqNr = MAX(SeqNr) + 1 FROM DDColumns WHERE TableName = @TableName
END ELSE BEGIN
SET @SeqNr = 0
END
--DDType 51 is used for Front office text, when SDKDeveloper toolkit then also create DD, will be
--deleted again in the CSSDKDevCustomSolutions.sql
IF (@DimType & 255) <> 51 OR (SELECT StringValue FROM BacoSettings WHERE SettingType = 0 AND SettingGroup = 'general' AND SettingName = 'GroupID') <> '' BEGIN
IF NOT EXISTS (SELECT ID FROM DDColumns WHERE Tablename = @TableName AND ColumnName = @DimColumnName) BEGIN
IF UPPER(@ColumnName) <> 'SYSGUID' OR (LEFT(UPPER(@TableName),2)= 'CS' OR LEFT(UPPER(@TableName),3) = 'SDK') BEGIN
IF @TermID IS NOT NULL SELECT @TermID = ID FROM TermsCustomized WHERE substring(CSTermID, len(CSTermID)-5, 6) = @TermID
INSERT INTO DDColumns (TableName, ColumnName,Description,TermID,Type,Length,Dimensions,Scale,Flags,SeqNr)
VALUES (@TableName,@ColumnName,@Description,@TermID,@DimType,@Length,@Dimensions,@Scale,@Flags,@SeqNr)
END
END
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
Go to Top of Page

Lesley249
Starting Member

11 Posts

Posted - 2010-11-10 : 05:25:36
quote:
Originally posted by webfred

It looks like you have a problem in your VB code.
But we can't see...


No, you're never too old to Yak'n'Roll if you're too young to die.


Thanks.
Will try to debug in..
Go to Top of Page
   

- Advertisement -