Showing posts with label syntax. Show all posts
Showing posts with label syntax. 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

Monday, March 19, 2012

Mysterious Views

I have two views in a production database that I did not create and I cannot account for. From the names used and the syntax of the views, it seems that the system (SQL Server) generated them.

Name: _hypmv_0_5771
Name: _hypmv_0

The syntax crushes the entire SELECT statement (4357 characters) onto a single line of T-SQL (not something I'm usually in the habit of doing).

I have read on kbAlertz that there was a bug in the original release of SQL server where the Index Tuning Wizard did not always remove hypothetical indices used to calculate performance improvements. I have not found anything related to hypothetical views. I do have indexed views, but none that reference these views.

I have checked dependencies; nothing depends on these views and they, in turn, do not depend on anything else.

Has anyone else encountered this problem? Aside from saving the definitions and then dropping them (just to see what may break), are there any suggestions for how to deal with this?

The database is medium-large. About 25GB.

Thanks,

Hugh ScottHere is the article on hypothetical indexes...

http://support.microsoft.com/?id=290414

Friday, March 9, 2012

mySQL -> msSQL

Hello all,

I spent the last two days trying to find an application that can export a mySQL database into msSQL syntax so that I can then use that to just create my msSQL database. I have had no such luck, though I could find a bunch to do msSQL to mySQL.

Please let me know if anyone has one or knows of one that works because I really do not want to hand port my 70 table database from mySQL to msSQL

Thanks in advance,

Anthony F Greco

DO you want application tool?

i found these two sites, not sure if it helps

http://www.softplatz.com/Soft/Network-Internet/Other/MySQL-MS-SQL-Server-Import-Export-Convert-Software.html

http://mysql-to-sql-server.qarchive.org/

|||Yes I did see them, I was just hopping to find a freeware one. If not I will go with one of them though. Thanks for the help =]|||

Hey

You could take a look at this:

Migrating MySQL to Microsoft SQL Server

I've done this before and just want to remind you that MySql is case sensitive but Sql server is not ,for example:

You hava column A(pk) B with values:

valueA valueB

valuea valueb

Sql Server will complain about violation ofprimary key constraint .

Hope this helps.

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