Showing posts with label incorrect. Show all posts
Showing posts with label incorrect. Show all posts

Friday, March 23, 2012

Named Calculation - Incorrect Syntax near ','

Dear friends,

I have a problem with a named calculation!

The problem isqhen I use values with decimal... like 0,5 or 3,125 that you can see in the bottom of my NC...

Could you help me?

CASE
WHEN [Open Amount]<=0 THEN 0
ELSE
((CASE
WHEN [D_INST_TIPO_ID]=1 THEN
CASE
WHEN [Price/NPV] = 0 THEN [Avg Flash]
ELSE [Price/NPV]
END
WHEN [D_INST_TIPO_ID]=2 THEN
CASE
WHEN [Price/NPV] <> 0 THEN [Price/NPV]
ELSE
CASE
WHEN [Princ Cumul Flash]=0 THEN [Avg Flash]
ELSE 100
END
END
END
+ [Acrd Today])/100*[Open Amount]/[Fxrate Rep Cur]) *

(CASE
WHEN [Basel Weight]<>20 THEN [Basel Weight]
ELSE
CASE
WHEN (CONVERT(DECIMAL(10,8),DATEDIFF("dd", [Date],[Maturity Date])/ CONVERT(DECIMAL(10,4), 365)))<=0,5 THEN 3,125

END

END)
END

Hi Pedro,

Try use . against ,

cya

|||

Hello. If you use a dot(.) instead of a decimal(,) will it not work?

HTH

Thomas Ivarsson

sql

Friday, March 9, 2012

MyLittleAdmin Error -2147217900 - Incorrect syntax near ''(''.

Hi,
I'm trying to create various tables on a hosted environment. Unfortunately the hosting company (lets just say 1 + 1 don't = 2) don't support remote connections so I can't access the DB using MS SQL Management Studio. So I have to use a 3rd party tool - MyLittleAdmin.

I can import scripts, and the majority of the time its ok, but I can't create certain tables that uses the generated scripts from Management Studio.

The error I received is:

Error -2147217900

Line 14: Incorrect syntax near '('.

The Script is:

Code Snippet

USE
[dbName]
GO
/****** Object: Table [dbo].[tfs_AreaManager] Script Date: 08/06/2007 14:29:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tfs_AreaManager](
[armId] [bigint] IDENTITY(1,1) NOT NULL,
[armUserId] [uniqueidentifier] NOT NULL,
[armAreaName] [nvarchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[armRgmId] [bigint] NULL,
[armFName] [nvarchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[armSName] [nvarchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[armEmail] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[armPhone] [nvarchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_tfs_AreaManagers] PRIMARY KEY CLUSTERED
(
[armId] 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
ALTER TABLE [dbo].[tfs_AreaManager] WITH CHECK ADD CONSTRAINT [FK_tfs_AreaManager_tfs_RegionManager] FOREIGN KEY([armRgmId])
REFERENCES [dbo].[tfs_RegionManager] ([rgmId])
GO
ALTER TABLE [dbo].[tfs_AreaManager] CHECK CONSTRAINT [FK_tfs_AreaManager_tfs_RegionManager]


I think line 14 refers to the 14th line counting from the 3rd GO instruction (code highlighted in RED).

Can anyone advise me as to what the problem is. I can create the table if I only use the script before the constraint operation. If I create the table, and then just script the constraints after, then they fail too. So I know it is the constraint opertaion that is the problem. Any help would be greatly appreciated!

Seems that you create the scripts with a SQL Server 2005 instance and the target one is a SQL Server 2000< one (or pretends to be in terms of compability level). So either change the compat level (if the target instance is a 2005 server) or create the scripts with compat level of your target database.

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

Oh that could be it! Do you know how I generate scripts for a SQL Server 2000 target?

Thanks for the help.

|||

If you are using the script generator you can use the "Script for Server Version" > SQL Server 2000

Jens K. Suessmeyer

http://www.sqlserver2005.de