由买买提看人间百态

topics

全部话题 - 话题: charindex
(共0页)
i**********e
发帖数: 1145
1
来自主题: JobHunting版 - 一道G题
I think you need to do DFS from all possible starting points in the grid, not just the top left point.
My code below for reference (does not return the path but return if the word is in the grid or not, should be easy to modify to return the path) :
#include
#include
using namespace std;
const int MAX_ROWS = 100;
const int MAX_COLS = 100;
bool dfs(char grid[][MAX_COLS], int row, int col, int m, int n,
int charIndex, string target, bool visited[][MAX_COLS]) {
if (ro... 阅读全帖
A***s
发帖数: 389
2
"UPDATE patient SET name = STUFF(name,CHARINDEX("'",name),1,"`") WHERE
CHARINDEX("'",name) <> 0"
就是找出name这项中的单引号换成反单引号,但这个单引号怎么也价不进去,我该怎么办
啊?谢谢
v**m
发帖数: 242
3
try this one:
UPDATE member SET email = STUFF(email,CHARINDEX('''',email),1,char(96))WHERE
CHARINDEX('''',email) <> 0

A***s
发帖数: 389
4
thx,just got the solution:
UPDATE member SET email = STUFF(email,CHARINDEX(char(39),email),1,'`')WHERE
CHARINDEX(char(39),email) <> 0

c**g
发帖数: 274
5
来自主题: Database版 - Can I use array in SQL stored procedure?
use a loop and charindex function.
Usually I join an array of String by ":", pass this joined string
as a single varchar parameter to stored procedure, then in
the stored procedure, a loop and charindex function go through
all of them. Can't write down the code without my reference. I
always copy/paste.
My bad memory really gave me a hard time during my job hunting
back years ago. I just can't remeber the syntax. It is the most embarrasing
moment when asked to wring code on paper, what a nightma
j****s
发帖数: 881
6
来自主题: Database版 - SQL的一个愚蠢小问题
select
left (whole_name, charindex(',', name)-1) as last_name,
right (whole_name, len(name)-charindex(',',name)) as first_name
from table
D*******2
发帖数: 3747
7
来自主题: _DaPsycho版 - 技术版面也太冷清了吧就也
猴子葛格我好爱你啊!!!!!我用很笨拙的办法搞出来了!!!!!
select substring(cmdtext,23,((charindex(')',substring(cmdtext,22,15))-
charindex('(',substring(cmdtext,22,15)))-1)) from dbo.spalog
v**m
发帖数: 242
8
I am glad things work out finally. There are a few question, just curious.
First, how did u add the single quote to the database? I guess it should be
two single quote, that's why you need use char(39) to get it. Second, how can
you put '`' there? copy & paste? I would suggest you use char(96) or correct
char() number.

STUFF(email,CHARINDEX('''',email),1,char(96))WHERE
p*****e
发帖数: 58
9
In SQL the character ' is used as escape character (plays the same role as \
in C) and quotation mark (similar to " in VB). So all ' in a string should be
replaced by ''.
Example 1: select all the tableName records where companyName is "Sam's Food":
Select * from tableName where companyName = 'Sam''s food'
Example 2: select all recordes where companyName containing ':
Select * from tableName where companyName like '%''%'

can
STUFF(email,CHARINDEX(char(39),email),1,'`')WHERE
k***e
发帖数: 7933
10
来自主题: Database版 - SQL的一个愚蠢小问题
use CHARINDEX, LEFT
g***l
发帖数: 18555
11
来自主题: Database版 - SQL的一个愚蠢小问题
CHARINDEX可以,也可以EXPORT出来成CSV,再IMPORT进来
y*****n
发帖数: 11251
12
来自主题: Database版 - T-SQL string split效率
最近在改一个不知多少年前的query,用了一个IN (,)。结果遇上一个几千条的list,
直接把sql server干掉了。决定改成temp table做inner join。那个list是作为参数传
过来的,中间
用,分开。如果用charindex一个一个断开做insert,效率怎么样啊? 会不会做split
的时候也把sql server搞得忙死?
y****w
发帖数: 3747
13
来自主题: Database版 - T-SQL string split效率
一个用charindex循环sql就拆好了,记得一定给临时表加个索引。效率肯定没问题。

split
b******t
发帖数: 10
14
来自主题: Database版 - how to extract text
我要extract譬如I和apple之间的所有字符,刚才看了上面的link,好像可以charindex
非常谢谢你
P********e
发帖数: 2610
15
来自主题: Programming版 - What does this mean in C++
int AppendString(
LPWSTR pStr,
UINT & charIndex
... )
in the header there is "..." in the parameter
what does this "..." mean?
(共0页)