Hi All.
Is there a way to retrieve the position of a word, phrase or sign in a field?
For example, Field content is ABCDEFG1239/1002STJ
I would like to get the exact position of / which will be position 12.
Thank you.
Best regardsThe patindex function should work for you here. But, it will only give you the location of the first one. Syntax:
PATINDEX ( '%pattern%' , expression )|||I wonder what he difference is?
SELECT PATINDEX ( '%/%' , 'ABCDEFG1239/1002STJ' )
SELECT CHARINDEX ( '/','ABCDEFG1239/1002STJ' )|||PatIndex() allows SQL Server regular expressions. CharIndex() only allows literals.
-PatP|||Who was that masked man?|||Hello All.
Thank you for your reply. I couldn't thank of you earlier because I was away to Europe on a business trip.
I will try out your solutions today.
Once again. Thank you.
Best regards
Showing posts with label word. Show all posts
Showing posts with label word. Show all posts
Monday, March 26, 2012
Wednesday, March 21, 2012
retrieving parent(ascendants)
i have a dimension named 'sdoc' which has 2 members
1) symptom word( first hierarchical level) and
2) doc id (second hierarchical level)
more than one 'symptom word' can have the same 'doc id'.
i want to know which all symptom words have a particular doc id (say 10.)
if i give [10].parent then it returns only the first parent whereas it actually has more than one parent.
how to retrieve all the parents.more than one 'symptom word' can have the same 'doc id'. So...there is a one-to-many relationship between 'doc id' and 'symptom word'?
if i give [10].parent then it returns only the first parent whereas it actually has more than one parent.So...there is a one-to-many relationship between 'symptom word' and 'doc id'?
Huh?
In database relationships, records normally have only one parent...
Please post the DDL code for the tables you are referencing, along with the SQL code you have tried.
1) symptom word( first hierarchical level) and
2) doc id (second hierarchical level)
more than one 'symptom word' can have the same 'doc id'.
i want to know which all symptom words have a particular doc id (say 10.)
if i give [10].parent then it returns only the first parent whereas it actually has more than one parent.
how to retrieve all the parents.more than one 'symptom word' can have the same 'doc id'. So...there is a one-to-many relationship between 'doc id' and 'symptom word'?
if i give [10].parent then it returns only the first parent whereas it actually has more than one parent.So...there is a one-to-many relationship between 'symptom word' and 'doc id'?
Huh?
In database relationships, records normally have only one parent...
Please post the DDL code for the tables you are referencing, along with the SQL code you have tried.
Labels:
ascendants,
database,
dimension,
doc,
hierarchical,
level,
members1,
microsoft,
mysql,
named,
oracle,
parent,
retrieving,
second,
server,
sql,
symptom,
word
Tuesday, March 20, 2012
Retrieving from SQLServer to Word
Please,
how can I execute a SQL command into SQLServer from Word/VBA code using ADO? I want to execute a comand and work with resulting recordset.
Best regards.Please see the following link:
dbforums link (http://dbforums.com/t390641.html)
If this does not help, please respond.
Good luck !|||Thanks a lot. It works fine.
how can I execute a SQL command into SQLServer from Word/VBA code using ADO? I want to execute a comand and work with resulting recordset.
Best regards.Please see the following link:
dbforums link (http://dbforums.com/t390641.html)
If this does not help, please respond.
Good luck !|||Thanks a lot. It works fine.
Subscribe to:
Posts (Atom)