SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 using nested string functions getting syntax error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

MarkInKeizer
Starting Member

USA
2 Posts

Posted - 08/14/2013 :  13:21:22  Show Profile  Reply with Quote
I'm a VB6/Access VBA developer and nesting together string functions to get a result is pretty standard stuff. I'm thinking it's not supported in SQL Server based on this. Is that true or do I have a bonehead error in here I'm simply not seeing? Thanks

SELECT FD.FieldID_FK
,F.TableName
,F.FieldName
,FD.FieldDescription
,SUBSTRING(FD.FieldDescription,charindex('CODE DESC',FD.FieldDescription),LEN(FD.FIELDDESCRIPTION) as fldGroupID
FROM [reference].[meta].[tblFIELDS_DESCRIPTION] FD, reference.meta.tblFIELDS F
WHERE fielddescription like '%CODE_DESC%' and
F.fieldid = FD.fieldid_fk

-----
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'as'.

VERSION INFO BELOW
SQL Server version 2005 -- 9.00.3042.00 SP2 Standard Edition (we'll be on 2008R2 in about two weeks).
Microsoft SQL Server Management Studio 10.0.2531.0
Microsoft Analysis Services Client Tools 10.0.1600.22
Microsoft Data Access Components (MDAC) 3.85.1132
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 8.0.6001.18702
Microsoft .NET Framework 2.0.50727.3615
Operating System 5.1.2600

Captain Kirk will be blasting Klingons before my employer retires WinXP Pro.
Mark

~Mark

MuMu88
Aged Yak Warrior

547 Posts

Posted - 08/14/2013 :  13:40:26  Show Profile  Reply with Quote

You are missing a parenthesis before 'as'
quote:
Originally posted by MarkInKeizer

I'm a VB6/Access VBA developer and nesting together string functions to get a result is pretty standard stuff. I'm thinking it's not supported in SQL Server based on this. Is that true or do I have a bonehead error in here I'm simply not seeing? Thanks

SELECT FD.FieldID_FK
,F.TableName
,F.FieldName
,FD.FieldDescription
,SUBSTRING(FD.FieldDescription,charindex('CODE DESC',FD.FieldDescription),LEN(FD.FIELDDESCRIPTION)) as fldGroupID
FROM [reference].[meta].[tblFIELDS_DESCRIPTION] FD, reference.meta.tblFIELDS F
WHERE fielddescription like '%CODE_DESC%' and
F.fieldid = FD.fieldid_fk

-----
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'as'.

VERSION INFO BELOW
SQL Server version 2005 -- 9.00.3042.00 SP2 Standard Edition (we'll be on 2008R2 in about two weeks).
Microsoft SQL Server Management Studio 10.0.2531.0
Microsoft Analysis Services Client Tools 10.0.1600.22
Microsoft Data Access Components (MDAC) 3.85.1132
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 8.0.6001.18702
Microsoft .NET Framework 2.0.50727.3615
Operating System 5.1.2600

Captain Kirk will be blasting Klingons before my employer retires WinXP Pro.
Mark

~Mark

Go to Top of Page

MarkInKeizer
Starting Member

USA
2 Posts

Posted - 08/14/2013 :  14:24:55  Show Profile  Reply with Quote
That was it, thanks MuMu88



~Mark
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000