显示标签为“contains”的博文。显示所有博文
显示标签为“contains”的博文。显示所有博文

2012年3月25日星期日

anyone have a snazzy way to count substrings?

Hi All,

I have a varchar that contains a comma-delimited list of integers, such as "12,34,56,78,123,1,123455".

I need a way to count the number of numbers in the string (or, perhaps, better stated as "I need a count of substrings") ;)

I'm thinking there must be a number of ways to calculate the number of numbers in my list of numbers, but I can only seem to come up with looping through the string/varchar and counting the number of commas, and then adding one to that final count.

Anybody know of a "cooler" way to do this? Everything I can think of involves stepping through a character at a time...

any (printable) thoughts?
THanks!I think it was Brett who came up with this method:

select (len(YourString) - len(replace(YourString, ',', ''))) + 1|||Outstanding!!! I thought about using "replace" but didn't come up with near as nice an idea - I guess that's why you guys get paid the big bucks! :D

I know you were just free-handin' it, but the actual syntax is thus:
select (len(@.YourString) - len(replace(@.YourString,',', '')) + 1)

Exactly what I was looking for though...THANKS!!!

You guys never let me down...someday I hope to bring a little something to the party besides questions! :D|||I think it was Brett who came up with this method:

select (len(YourString) - len(replace(YourString, ',', ''))) + 1

Thanks...not hardly...I think it was Nigel who showed me...

http://www.sqlteam.com/forums/pop_profile.asp?mode=display&id=1578

Although if you think about it's perfectly logical...

Once I saw that one, everytime I see a "complicated" problem, I step back and look for an easy answer...

Doesn't always work for me...

The theta join stuff still gives me pause...|||The theta join stuff still gives me pause...
piece o' cake

it's just a cross join with a loose condition

in fact, an inner join is just a cross join with a more restrictive condition

here's a perfect example of a theta join --

http://www.dbforums.com/showthread.php?p=3671683#post3671683|||The only way it works if you give something back. I use to be that way. Only asking question and no even trying to help someone else out there. Just remember that. Even if you take one question a week. I try to do at least one a day during the week.|||Gotcha GarryDawkins,

I am a member in quite a few forums related to the restoration of classic cars ;) so I know the importance of contributing. Otherwise, if everyone asks the questions without answering any, ummm...well...the forums would be quite a bit more boring *LOL*

I've got about 15 years of SQL experience, though mostly on Tandem Nonstop and Oracle, but have just recently started out with SQL Server, so am sure I can contribute once I've gotten past the initial curve.

Meanwhile, I'll ask questions and appreciate the knowledge and willingness to help of everyone else! and the help IS appreciated!

In fact, I did run across (on another forum, I think) a GREAT example of the reverse of this thread, which is how to build a comma-delimited string for use in, for example, a "dynamic" IN... clause...(the lead-in and example are modified to my application) - I posted this in an internal forum at my company).

I needed a way to do both, and found a way to do it easily with a function I didn't even know existed before yesterday! *L*:

Another, more efficient alternative is to use the COALESCE function,
which is much more efficient than the use of the cursor option, and also
shortens the cursor-supporting code block to a single select statement:

DECLARE @.PortfolioList varchar(100)

SELECT @.PortfolioList = COALESCE(@.PortfolioList + ',', '') +
CAST(PortfolioID AS varchar(5))
FROM Portfolio
ORDER BY PortfolioID

SELECT @.PortfolioList as CSVList

which results in the following output:
CSV_List
----------------------
11,67,90,100,105,110,115,120,125,130,135,140,145,1 50,155

(1 row(s) affected)

The COALESCE function performs the magic here. When @.PortfolioList is NULL
(the first row processed), it returns an empty string. On subsequent rows, it
concatenates the @.PortfolioList value with a comma and the current
PortfolioID value.|||Damn...that just looks sooooooooooo familiar...

Using COALESCE to Build Comma-Delimited String (http://www.sqlteam.com/item.asp?ItemID=2368)|||In fact, I did run across (on another forum, I think) a GREAT example of the reverse of this thread,

and quite interestingly so, eh? ;) In case anyone misinterpreted my comment and is thinking about wacking me with a plagarism stick, I also reworded my "example is mine" to read, correctly, that "the lead-in and example are modified to my application"

I have no interest in taking credit for the creativity of others, though I with great frequency use it with great glee and bastardize it without remorse or hindsight to be of use within my own evil empire. BwahahahahaHAHAHA!|||I have no interest in taking credit for the creativity of others, though I with great frequency use it with great glee and bastardize it without remorse or hindsight to be of use within my own evil empire. BwahahahahaHAHAHA!
good developers steal

great developers steal and pass it on to others

;)|||good developers steel

great developers steel and pass it on to others

;)

Or they can copper, iron, nickel or gold

:D|||Or they can copper, iron, nickel or gold

:D

I once tried to make some little spheres of tin and copper, but it got too hot and mixed together somehow, and all I ended up with was a HUGE mess and a pair of bronze balls. *sigh*

...but I digress...

hey, if you jack your own thread, is it still a thread-jacking? :D|||i've had my balls bronzed, too|||Was that before or after the Leiderhosen picture? It's hard to tell, 'cause the image is so small...|||Was that before or after the Leiderhosen picture? It's hard to tell, 'cause the image is so small...

Ouch, that's gonna leave a scar... :D|||Was that before or after the Leiderhosen picture? It's hard to tell, 'cause the image is so small...

wanna see the big version? http://rudy.ca/quatsch.cfm|||Ah. Definitely after... :o

anyone good with SQL querries?

I have a query that contains a sub query. The problem is that the sub query
returns more than 1 value so it fails with the error (Subquery returned more
than 1 value). Here is a simplified version of how it is setup.
Select * from table1 where column2 = (select col2 from table2 where column 3
=4)
So for the example below it should return rows 1 and 3 from table 1 since a
and c were returned in the subquery.
table 1
col1 col2
1 a
2 b
3 c
table 2
col1 col2 col3
1 a 4
2 b 2
3 c 4
thanks.
Paul G
Software engineer.
On Tue, 30 Jan 2007 16:35:00 -0800, Paul
<Paul@.discussions.microsoft.com> wrote:

>I have a query that contains a sub query. The problem is that the sub query
>returns more than 1 value so it fails with the error (Subquery returned more
>than 1 value). Here is a simplified version of how it is setup.
>Select * from table1 where column2 = (select col2 from table2 where column 3
>=4)
>So for the example below it should return rows 1 and 3 from table 1 since a
>and c were returned in the subquery.
>table 1
>col1 col2
>1 a
>2 b
>3 c
>table 2
>col1 col2 col3
>1 a 4
>2 b 2
>3 c 4
>thanks.
Select * from table1 where column2 in
(select col2 from table2 where column 3 >=4)
J.
|||thanks that is what I was looking for!
Paul G
Software engineer.
"JXStern" wrote:

> On Tue, 30 Jan 2007 16:35:00 -0800, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
> Select * from table1 where column2 in
> (select col2 from table2 where column 3 >=4)
>
> J.
>
>

anyone good with SQL querries?

I have a query that contains a sub query. The problem is that the sub query
returns more than 1 value so it fails with the error (Subquery returned more
than 1 value). Here is a simplified version of how it is setup.
Select * from table1 where column2 = (select col2 from table2 where column 3
=4)
So for the example below it should return rows 1 and 3 from table 1 since a
and c were returned in the subquery.
table 1
col1 col2
1 a
2 b
3 c
table 2
col1 col2 col3
1 a 4
2 b 2
3 c 4
thanks.
--
Paul G
Software engineer.On Tue, 30 Jan 2007 16:35:00 -0800, Paul
<Paul@.discussions.microsoft.com> wrote:
>I have a query that contains a sub query. The problem is that the sub query
>returns more than 1 value so it fails with the error (Subquery returned more
>than 1 value). Here is a simplified version of how it is setup.
>Select * from table1 where column2 = (select col2 from table2 where column 3
>=4)
>So for the example below it should return rows 1 and 3 from table 1 since a
>and c were returned in the subquery.
>table 1
>col1 col2
>1 a
>2 b
>3 c
>table 2
>col1 col2 col3
>1 a 4
>2 b 2
>3 c 4
>thanks.
Select * from table1 where column2 in
(select col2 from table2 where column 3 >=4)
J.|||thanks that is what I was looking for!
--
Paul G
Software engineer.
"JXStern" wrote:
> On Tue, 30 Jan 2007 16:35:00 -0800, Paul
> <Paul@.discussions.microsoft.com> wrote:
> >I have a query that contains a sub query. The problem is that the sub query
> >returns more than 1 value so it fails with the error (Subquery returned more
> >than 1 value). Here is a simplified version of how it is setup.
> >
> >Select * from table1 where column2 = (select col2 from table2 where column 3
> >=4)
> >So for the example below it should return rows 1 and 3 from table 1 since a
> >and c were returned in the subquery.
> >
> >table 1
> >col1 col2
> >1 a
> >2 b
> >3 c
> >
> >table 2
> >col1 col2 col3
> >1 a 4
> >2 b 2
> >3 c 4
> >thanks.
> Select * from table1 where column2 in
> (select col2 from table2 where column 3 >=4)
>
> J.
>
>

anyone good with SQL querries?

I have a query that contains a sub query. The problem is that the sub query
returns more than 1 value so it fails with the error (Subquery returned more
than 1 value). Here is a simplified version of how it is setup.
Select * from table1 where column2 = (select col2 from table2 where column 3
=4)
So for the example below it should return rows 1 and 3 from table 1 since a
and c were returned in the subquery.
table 1
col1 col2
1 a
2 b
3 c
table 2
col1 col2 col3
1 a 4
2 b 2
3 c 4
thanks.
--
Paul G
Software engineer.On Tue, 30 Jan 2007 16:35:00 -0800, Paul
<Paul@.discussions.microsoft.com> wrote:

>I have a query that contains a sub query. The problem is that the sub quer
y
>returns more than 1 value so it fails with the error (Subquery returned mor
e
>than 1 value). Here is a simplified version of how it is setup.
>Select * from table1 where column2 = (select col2 from table2 where column
3
>=4)
>So for the example below it should return rows 1 and 3 from table 1 since a
>and c were returned in the subquery.
>table 1
>col1 col2
>1 a
>2 b
>3 c
>table 2
>col1 col2 col3
>1 a 4
>2 b 2
>3 c 4
>thanks.
Select * from table1 where column2 in
(select col2 from table2 where column 3 >=4)
J.|||thanks that is what I was looking for!
--
Paul G
Software engineer.
"JXStern" wrote:

> On Tue, 30 Jan 2007 16:35:00 -0800, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
> Select * from table1 where column2 in
> (select col2 from table2 where column 3 >=4)
>
> J.
>
>sql

2012年3月22日星期四

Any work around to pass parameters to OPENQUERY

I need to query a linked server which contains a table of million records an
d
need to fetch only the relevant records from the linked server.
Any ideas? Please helpSaji
Have you tried to use WHERE condition? Can you show us what you are trying
to do?
"Saji" <Saji@.discussions.microsoft.com> wrote in message
news:31530C04-03B9-4C24-9169-CBBD26773F3C@.microsoft.com...
>I need to query a linked server which contains a table of million records
>and
> need to fetch only the relevant records from the linked server.
> Any ideas? Please help|||This seems to work..
SELECT * FROM OPENQUERY(PS, '
SELECT
*
FROM
TESTDTA.F0401Z1
JOIN TESTDTA.F0101Z2 ON TESTDTA.F0401Z1.VOAN8 = TESTDTA.F0101Z2.SZAN8
WHERE
VOEDSP != ''C'' AND
VODRIN = ''2''
ORDER BY VOAN8, VOEDBT
')
"Saji" wrote:

> I need to query a linked server which contains a table of million records
and
> need to fetch only the relevant records from the linked server.
> Any ideas? Please help

2012年3月11日星期日

Any suggestions?

I have a database which contains more than 20000 stored procedures
which were created with
ansi nulls off. This i found out using the query
SELECT name,AnsiNullsOn FROM
(
SELECT name, OBJECTPROPERTY(id, 'ExecIsAnsiNullsOn') AS AnsiNullsOn
FROM sysobjects WHERE type = 'P' ) A WHERE AnsiNullsOn=0

Is there any way that i can set this property to 1 for all the stored
procedures i have??

I know the alternate method is to drop the procedure and execute the
scripts again with AnsiNullsOn = 1.

Is there any other simple ways?? It will be very helpful for me..I believe this will do the job, though I suggest some small-scale
tests first.

1) Script out all the procs as CREATEs, but do not include the DROP
option.

2) Edit the script.

- Change CREATE PROC to ALTER PROC for all procedures.

- Change all the SET ANSI_NULLS ( and possibly the SET
QUOTED_IDENTIFIER) commands as you want them.

3) Run the script.

Roy Harvey
Beacon Falls, CT

On 21 Nov 2006 14:17:38 -0800, "balaji" <mailbalajijagan@.gmail.com>
wrote:

Quote:

Originally Posted by

>I have a database which contains more than 20000 stored procedures
>which were created with
>ansi nulls off. This i found out using the query
>SELECT name,AnsiNullsOn FROM
>(
>SELECT name, OBJECTPROPERTY(id, 'ExecIsAnsiNullsOn') AS AnsiNullsOn
>FROM sysobjects WHERE type = 'P' ) A WHERE AnsiNullsOn=0
>
>Is there any way that i can set this property to 1 for all the stored
>procedures i have??
>
>I know the alternate method is to drop the procedure and execute the
>scripts again with AnsiNullsOn = 1.
>
>Is there any other simple ways?? It will be very helpful for me..

|||balaji wrote:

Quote:

Originally Posted by

I have a database which contains more than 20000 stored procedures
which were created with
ansi nulls off. This i found out using the query
SELECT name,AnsiNullsOn FROM
(
SELECT name, OBJECTPROPERTY(id, 'ExecIsAnsiNullsOn') AS AnsiNullsOn
FROM sysobjects WHERE type = 'P' ) A WHERE AnsiNullsOn=0
>
Is there any way that i can set this property to 1 for all the stored
procedures i have??
>
I know the alternate method is to drop the procedure and execute the
scripts again with AnsiNullsOn = 1.
>
Is there any other simple ways?? It will be very helpful for me..


Just to state the obvious. Since there are potential behaviour changes
associated with changing the setting it seems like the bigger task
could be testing the procs rather than making the change.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/...US,SQL.90).aspx
--

2012年3月6日星期二

Any possible optimization for the following SQL statement

Hi all,
I am relatively new to this group and forgive me if this question is
too trivial...
Say, I have an audit table AccountAudit that contains account records.
When each batch of rows are inserted, the timestamp is saved at
UpdateTime column. At a certain timestamp, there are multiple rows for
an account.
Now, given an Account# and ActionType, I'd like to get the 1st and 2rd
most recent groups of rows. Here is my SQL statement. I wonder if there
is any way to optimize it.
select * from AccountAudit where Account = 4 and ActionType = 'C'
and UpdatedTime in
(select distinct top 2 UpdatedTime from AccountAudit
where Account = 4 and ActionType = 'C'
order by UpdatedTime desc)
Thanks in advance.
FrankYou could also do this in a single SELECT instead of the nested query.
SELECT DISTINCT TOP 2 Account, ActionType, UpdatedTime
FROM Accounts
WHERE Account = 4 and ActionType = 'C'
ORDER BY UpdatedTime DESC|||To add to Lubdha's response, it is also very important to consider indexing.
A composite index on Account, ActionType, UpdatedTime may help optimize this
particular query. You'll need to consider your overall workload in order to
determine the best indexing strategy.
--
Hope this helps.
Dan Guzman
SQL Server MVP
<fzhang@.calamos.com> wrote in message
news:1149881438.607379.14290@.i39g2000cwa.googlegroups.com...
> Hi all,
> I am relatively new to this group and forgive me if this question is
> too trivial...
> Say, I have an audit table AccountAudit that contains account records.
> When each batch of rows are inserted, the timestamp is saved at
> UpdateTime column. At a certain timestamp, there are multiple rows for
> an account.
> Now, given an Account# and ActionType, I'd like to get the 1st and 2rd
> most recent groups of rows. Here is my SQL statement. I wonder if there
> is any way to optimize it.
> select * from AccountAudit where Account = 4 and ActionType = 'C'
> and UpdatedTime in
> (select distinct top 2 UpdatedTime from AccountAudit
> where Account = 4 and ActionType = 'C'
> order by UpdatedTime desc)
>
> Thanks in advance.
> Frank
>

Any possible optimization for the following SQL statement

Hi all,
I am relatively new to this group and forgive me if this question is
too trivial...
Say, I have an audit table AccountAudit that contains account records.
When each batch of rows are inserted, the timestamp is saved at
UpdateTime column. At a certain timestamp, there are multiple rows for
an account.
Now, given an Account# and ActionType, I'd like to get the 1st and 2rd
most recent groups of rows. Here is my SQL statement. I wonder if there
is any way to optimize it.
select * from AccountAudit where Account = 4 and ActionType = 'C'
and UpdatedTime in
(select distinct top 2 UpdatedTime from AccountAudit
where Account = 4 and ActionType = 'C'
order by UpdatedTime desc)
Thanks in advance.
FrankYou could also do this in a single SELECT instead of the nested query.
SELECT DISTINCT TOP 2 Account, ActionType, UpdatedTime
FROM Accounts
WHERE Account = 4 and ActionType = 'C'
ORDER BY UpdatedTime DESC|||To add to Lubdha's response, it is also very important to consider indexing.
A composite index on Account, ActionType, UpdatedTime may help optimize this
particular query. You'll need to consider your overall workload in order to
determine the best indexing strategy.
Hope this helps.
Dan Guzman
SQL Server MVP
<fzhang@.calamos.com> wrote in message
news:1149881438.607379.14290@.i39g2000cwa.googlegroups.com...
> Hi all,
> I am relatively new to this group and forgive me if this question is
> too trivial...
> Say, I have an audit table AccountAudit that contains account records.
> When each batch of rows are inserted, the timestamp is saved at
> UpdateTime column. At a certain timestamp, there are multiple rows for
> an account.
> Now, given an Account# and ActionType, I'd like to get the 1st and 2rd
> most recent groups of rows. Here is my SQL statement. I wonder if there
> is any way to optimize it.
> select * from AccountAudit where Account = 4 and ActionType = 'C'
> and UpdatedTime in
> (select distinct top 2 UpdatedTime from AccountAudit
> where Account = 4 and ActionType = 'C'
> order by UpdatedTime desc)
>
> Thanks in advance.
> Frank
>

2012年2月18日星期六

Any good whitepapers on security/deployment for entire SQL Server BI solutions?

At my current employer we are struggling with the best way to manage security and deployment of a project that contains databases, SSIS, SSAS and SSRS components, using configurations.

Environment (Dev):

3 SQL Server databases, all using mixed-mode security, using SQL Server security credentials.

12 SSIS packages; one master package, eleven child packages, 3 shared data sources

1 SSAS database; one cube, 15 dimensions, three referenced data sources from the SSIS project (in same solution)

6 SSRS reports, one data source to cube (not shared- doesn't appear SSRS can share datasources among other projects in the solution? Why?)

Everything runs fine in development. Now comes the tricky part.

Deploying SSIS and SSAS into production environments:

-Packages use XML config files for connection strings to three relational data sources.

-Deploy to SQL Server storage. Deploy wizard copies package dependencies (including XML config files) to default location set in INI file. When I do this, no config file shows up in remote server (remote server not set up identical to local, so directory does not exist. Need UNC path?) So, being a developer with no "special" permissions on the PROD server, what security permissions is allowing the deployment wizard from copying files to this location on a production server?

-Using a deploy script using dtutil doesn't copy the SSIS dependencies. Is this matter of using COPY or XCOPY to copy the configuration files to the dependency location? Again, in real-world practice, do developers typically change this location in the INI file to another location, or stick with the default. In either case, how does security work that allows files to get copied to the remote folder? (i.e. manual, or SQL Server manages this file folder permission through some other magic)

When using SSMS and running the package after being deployed on the remote server, if the config path is the default (e.g. C:\program files\Microsoft SQL Server\90\DTS\Packages\...) it appears to be read from the local machines directory rather than the remote machines directory path (do I need to use UNC paths? The wizard doesn't give this option it seems)

-When scheduling the job from SQL Agent, does the proxy account need permissions to the folder the config files sit in?

-What about the roles security on the packages themselves? Where does the server roles come into play (dtsltuser, dtsadmin)

-Because the SSAS project uses connection references to the SSIS project in BIDS, and SSIS project uses configurations, will SSAS pick up on these connections?

-What about impersonation levels for SSAS? Leave all data sources set to default, and set the database impersonation level to "UseServiceAccount"? What if the developer is not the same as the OLAP administrator on the production server? In this case, Use Service Account isn't an option, and neither is the current users credentials.

-SSAS database also has security for Full Control, but still doesn't prevent security at the data source level within the database (talking about impersonation level, not source db credentials)

-How can SSRS connections leverage other shared connections?

As you can see, there are a ton of security considerations, none of which are intuitive and can be configured multiple ways and actually work (and a ton of ways that won't work).

I need a simple cheat-sheet about each step to take to configure this so multiple developers can work without interruption, hot-deploying SSIS, SSAS, and SSRS changes into different environments (QA, PROD).

-Kory

It is still on my list to read so I'm not sure it contains the information you need but check http://www.microsoft.com/technet/prodtechnol/sql/2005/sql2005secbestpract.mspx

WesleyB

Visit my SQL Server weblog @. http://dis4ea.blogspot.com

|||

I've already read this- not much on the BI tools side, mostly for the RDBMS.

-Kory

Any function?

Hi, any function wich returns me if contains some string inside another
string for using on SP?
InStr?
ThanksCHARINDEX ,PATINDEX'
"Paulo" <prbspfc@.uol.com.br> wrote in message
news:u2BJWIUeIHA.4844@.TK2MSFTNGP04.phx.gbl...
> Hi, any function wich returns me if contains some string inside another
> string for using on SP?
> InStr?
> Thanks
>|||if CHARINDEX('5.0', SELECT @.@.VERSION) = 0 then 'WIN 2000
if CHARINDEX('5.1', SELECT @.@.VERSION) = 0 then 'WIN XP
if CHARINDEX('5.2', SELECT @.@.VERSION) = 0 then 'WIN2K3
Should work?
Thanks man!
"Uri Dimant" <urid@.iscar.co.il> escreveu na mensagem
news:uDZFoKUeIHA.5348@.TK2MSFTNGP03.phx.gbl...
> CHARINDEX ,PATINDEX'
> "Paulo" <prbspfc@.uol.com.br> wrote in message
> news:u2BJWIUeIHA.4844@.TK2MSFTNGP04.phx.gbl...
>> Hi, any function wich returns me if contains some string inside another
>> string for using on SP?
>> InStr?
>> Thanks
>>
>|||Paulo
CREATE TABLE #tmp (c VARCHAR(1000))
GO
INSERT INTO #tmp EXEC('SELECT @.@.VERSION')
SELECT CASE WHEN CHARINDEX('5.0', c) > 0 then 'WIN 2000'
WHEN CHARINDEX('5.1', c) > 0 then 'WIN XP'
WHEN CHARINDEX('5.2', c) > 0 then 'WIN2K3' END
FROM #tmp
"Paulo" <prbspfc@.uol.com.br> wrote in message
news:ucf0TSUeIHA.288@.TK2MSFTNGP02.phx.gbl...
> if CHARINDEX('5.0', SELECT @.@.VERSION) = 0 then 'WIN 2000
> if CHARINDEX('5.1', SELECT @.@.VERSION) = 0 then 'WIN XP
> if CHARINDEX('5.2', SELECT @.@.VERSION) = 0 then 'WIN2K3
> Should work?
> Thanks man!
> "Uri Dimant" <urid@.iscar.co.il> escreveu na mensagem
> news:uDZFoKUeIHA.5348@.TK2MSFTNGP03.phx.gbl...
>> CHARINDEX ,PATINDEX'
>> "Paulo" <prbspfc@.uol.com.br> wrote in message
>> news:u2BJWIUeIHA.4844@.TK2MSFTNGP04.phx.gbl...
>> Hi, any function wich returns me if contains some string inside another
>> string for using on SP?
>> InStr?
>> Thanks
>>
>>
>|||Thanks man... very good !
"Uri Dimant" <urid@.iscar.co.il> escreveu na mensagem
news:uqwDEZUeIHA.5208@.TK2MSFTNGP04.phx.gbl...
> Paulo
> CREATE TABLE #tmp (c VARCHAR(1000))
> GO
> INSERT INTO #tmp EXEC('SELECT @.@.VERSION')
> SELECT CASE WHEN CHARINDEX('5.0', c) > 0 then 'WIN 2000'
> WHEN CHARINDEX('5.1', c) > 0 then 'WIN XP'
> WHEN CHARINDEX('5.2', c) > 0 then 'WIN2K3' END
> FROM #tmp
>
>
>
> "Paulo" <prbspfc@.uol.com.br> wrote in message
> news:ucf0TSUeIHA.288@.TK2MSFTNGP02.phx.gbl...
>> if CHARINDEX('5.0', SELECT @.@.VERSION) = 0 then 'WIN 2000
>> if CHARINDEX('5.1', SELECT @.@.VERSION) = 0 then 'WIN XP
>> if CHARINDEX('5.2', SELECT @.@.VERSION) = 0 then 'WIN2K3
>> Should work?
>> Thanks man!
>> "Uri Dimant" <urid@.iscar.co.il> escreveu na mensagem
>> news:uDZFoKUeIHA.5348@.TK2MSFTNGP03.phx.gbl...
>> CHARINDEX ,PATINDEX'
>> "Paulo" <prbspfc@.uol.com.br> wrote in message
>> news:u2BJWIUeIHA.4844@.TK2MSFTNGP04.phx.gbl...
>> Hi, any function wich returns me if contains some string inside another
>> string for using on SP?
>> InStr?
>> Thanks
>>
>>
>>
>

2012年2月16日星期四

Any function?

Hi, any function wich returns me if contains some string inside another
string for using on SP?
InStr?
Thanks
CHARINDEX ,PATINDEX?
"Paulo" <prbspfc@.uol.com.br> wrote in message
news:u2BJWIUeIHA.4844@.TK2MSFTNGP04.phx.gbl...
> Hi, any function wich returns me if contains some string inside another
> string for using on SP?
> InStr?
> Thanks
>
|||if CHARINDEX('5.0', SELECT @.@.VERSION) = 0 then 'WIN 2000
if CHARINDEX('5.1', SELECT @.@.VERSION) = 0 then 'WIN XP
if CHARINDEX('5.2', SELECT @.@.VERSION) = 0 then 'WIN2K3
Should work?
Thanks man!
"Uri Dimant" <urid@.iscar.co.il> escreveu na mensagem
news:uDZFoKUeIHA.5348@.TK2MSFTNGP03.phx.gbl...
> CHARINDEX ,PATINDEX?
> "Paulo" <prbspfc@.uol.com.br> wrote in message
> news:u2BJWIUeIHA.4844@.TK2MSFTNGP04.phx.gbl...
>
|||Paulo
CREATE TABLE #tmp (c VARCHAR(1000))
GO
INSERT INTO #tmp EXEC('SELECT @.@.VERSION')
SELECT CASE WHEN CHARINDEX('5.0', c) > 0 then 'WIN 2000'
WHEN CHARINDEX('5.1', c) > 0 then 'WIN XP'
WHEN CHARINDEX('5.2', c) > 0 then 'WIN2K3' END
FROM #tmp
"Paulo" <prbspfc@.uol.com.br> wrote in message
news:ucf0TSUeIHA.288@.TK2MSFTNGP02.phx.gbl...
> if CHARINDEX('5.0', SELECT @.@.VERSION) = 0 then 'WIN 2000
> if CHARINDEX('5.1', SELECT @.@.VERSION) = 0 then 'WIN XP
> if CHARINDEX('5.2', SELECT @.@.VERSION) = 0 then 'WIN2K3
> Should work?
> Thanks man!
> "Uri Dimant" <urid@.iscar.co.il> escreveu na mensagem
> news:uDZFoKUeIHA.5348@.TK2MSFTNGP03.phx.gbl...
>
|||Thanks man... very good !
"Uri Dimant" <urid@.iscar.co.il> escreveu na mensagem
news:uqwDEZUeIHA.5208@.TK2MSFTNGP04.phx.gbl...
> Paulo
> CREATE TABLE #tmp (c VARCHAR(1000))
> GO
> INSERT INTO #tmp EXEC('SELECT @.@.VERSION')
> SELECT CASE WHEN CHARINDEX('5.0', c) > 0 then 'WIN 2000'
> WHEN CHARINDEX('5.1', c) > 0 then 'WIN XP'
> WHEN CHARINDEX('5.2', c) > 0 then 'WIN2K3' END
> FROM #tmp
>
>
>
> "Paulo" <prbspfc@.uol.com.br> wrote in message
> news:ucf0TSUeIHA.288@.TK2MSFTNGP02.phx.gbl...
>

2012年2月13日星期一

any *simple* external activation examples available?

BOL only seems to say that you can do it w/o really showing how, and the ExternalActivator sample at gotdotnet.com contains so much functionality I'm not sure what's required just for the external activation. Are there any docs or samples out there that focus on how to do it w/o obscuring the matter with a bunch of other functionality? (I prefer docs to project samples, b/c the samples tend to have hacks like hardcoded paths and connection strings so that they rarely work correctly right out of the box.)

TIA

The sample tries to do it correctly. That is, it must gaurantee that it will try to launch the process even under memory pressure and process failure. If it didn't, there is the danger of orphaning messages in the application queue. In order to provide this gaurantee, it must implement basic recovery logging. That adds to the complexity.