June 7, 2016 at 8:55 am
Luis Cazares (6/7/2016)
Jeff Moden (6/7/2016)
Luis Cazares (6/7/2016)
Try this:
SELECT sys.fn_get_folder(path, 1)
Absolutely the correct answer! π Well, except for the Hungarian notation used. :hehe:
That's the MS standard. π
MS has a standard? When did that happen?
June 7, 2016 at 8:59 am
Luis Cazares (6/7/2016)
Was I too late for April fools' day?This is what happens when you trust a forum to answer questions that you should answer on your own.
I could have given a real answer, but this is an example of the reasons behind my disclaimer. I wouldn't want someone that uses something without at least understanding how it works or at least point to some documentation for it.
If I was interviewing this person, I wouldn't mind if the answer is incorrect as long as it demonstrates knowledge on string manipulation and creativity to solve problems.
I personally would put string manipulation using T-SQL in the same category as programming a row-by-row cursor; I don't consider it to a core competency for a T-SQL developer. I'd ask questions about joining, grouping, ranking, indexing, isolation, and execution plans before I would test someone's knowledge about string manipulation, but then again I'm typically sitting in on a panel interview and can only ask maybe a half dozen questions. So I typically bypass the Programming 101 stuff and zoom in on what I really expect from senior level database developer.
It's a good topic for a forum discussion, I'm just saying it's not a good interview question within the context of a SQL Server Developer/DBA position.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
June 7, 2016 at 9:03 am
Eric M Russell (6/7/2016)
So I typically bypass the Programming 101 stuff and zoom in on what I really expect from senior level database developer.
I do expect Senior level Database Developers to be able to do simple string manipulations even if they're a rocket scientist on other things.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 7, 2016 at 9:04 am
Ed Wagner (6/7/2016)
Luis Cazares (6/7/2016)
Jeff Moden (6/7/2016)
Luis Cazares (6/7/2016)
Try this:
SELECT sys.fn_get_folder(path, 1)
Absolutely the correct answer! π Well, except for the Hungarian notation used. :hehe:
That's the MS standard. π
MS has a standard? When did that happen?
Now you understand what the standard actually is. π
--Jeff Moden
Change is inevitable... Change for the better is not.
June 7, 2016 at 9:06 am
Jeff Moden (6/7/2016)
Ed Wagner (6/7/2016)
Luis Cazares (6/7/2016)
Jeff Moden (6/7/2016)
Luis Cazares (6/7/2016)
Try this:
SELECT sys.fn_get_folder(path, 1)
Absolutely the correct answer! π Well, except for the Hungarian notation used. :hehe:
That's the MS standard. π
MS has a standard? When did that happen?
Now you understand what the standard actually is. π
Which one - the inconsistent naming conventions or the slowness of new functionality?
June 7, 2016 at 9:08 am
Jeff Moden (6/7/2016)
Eric M Russell (6/7/2016)
So I typically bypass the Programming 101 stuff and zoom in on what I really expect from senior level database developer.I do expect Senior level Database Developers to be able to do simple string manipulations even if they're a rocket scientist on other things.
Yeah, but basically anyone can do simple string manipulation; that's like a 7th grade homework assignment. I'd rather have a candidate explain to me why they wouldn't do string manipulation in a stored procedure. Then I feel comfortable having them code behind me.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
June 7, 2016 at 9:13 am
Jeff Moden (6/7/2016)
Eric M Russell (6/7/2016)
They're asking the wrong type of questions for a job interview.I think it's a great question. It shows whether or not you actually know much about string manipulation. It's not a difficult question and, once I know if someone can actually get the current date and time (something like 80% have failed that simple question), then I move on to things like this. Both DBAs and Developers need to know simple stuff like this.
I actually used that in our last round of interviews. "Can you state one way you might get the current system time using t-sql?". This was a developer position but we do all of our own queries. Out of about 20 we had one person who gave the very shocked and nervous "getdate?".
The other I like to ask is "what are some steps we can use to prevent sql injection". I got the most creative answer ever recently. After sitting there in obvious pain and being totally silent for nearly two full minutes (no exaggeration) the interviewee stated something to the effect of "we can leverage sql injection to improve the performance". :w00t:
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 7, 2016 at 9:13 am
Eric M Russell (6/7/2016)
Jeff Moden (6/7/2016)
Eric M Russell (6/7/2016)
So I typically bypass the Programming 101 stuff and zoom in on what I really expect from senior level database developer.I do expect Senior level Database Developers to be able to do simple string manipulations even if they're a rocket scientist on other things.
Yeah, but basically anyone can do simple string manipulation; that's like a 7th grade homework assignment. I'd rather have a candidate explain to me why they wouldn't do string manipulation in a stored procedure. Then I feel comfortable having them code behind me.
Evidently not. I'd say this would make a pretty decent phone interview question.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 7, 2016 at 9:28 am
ChrisM@Work (6/7/2016)
Sean Lange (6/7/2016)
Luis Cazares (6/7/2016)
Try this:
SELECT sys.fn_get_folder(path, 1)
LOL that is hilarious Luis. And it seems to have fooled Lowell and Chris too. That is too funny.
Haven't you got one of these Sean?
ALTER FUNCTION dbo.fn_get_folder
(@path VARCHAR(255), @Element TINYINT)
RETURNS TABLE
AS
RETURN (
SELECT Element = NULLIF(SUBSTRING(@path, MIN(n)+1, MAX(n)-MIN(n)),'')
FROM (
SELECT
n, Item = ROW_NUMBER() OVER(ORDER BY (SELECT NULL))
FROM (
SELECT n = 0
UNION ALL
SELECT n
FROM (
SELECT TOP(LEN(@path)) n = ROW_NUMBER() OVER(ORDER BY (SELECT NULL))
FROM (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t1 (n),
(VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t2 (n)
) _tally
WHERE SUBSTRING(@path,n,1) = '\'
UNION ALL
SELECT n = LEN(@path)
) p
) q
WHERE Item = @Element OR Item = @Element+1
)
GO
SELECT Element FROM dbo.fn_get_folder ('c:\Programmefiles\Dicument\file1.txt',1)
I do now!!! π
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 7, 2016 at 9:31 am
Sean Lange (6/7/2016)
ChrisM@Work (6/7/2016)
Sean Lange (6/7/2016)
Luis Cazares (6/7/2016)
Try this:
SELECT sys.fn_get_folder(path, 1)
LOL that is hilarious Luis. And it seems to have fooled Lowell and Chris too. That is too funny.
Haven't you got one of these Sean?
ALTER FUNCTION dbo.fn_get_folder
(@path VARCHAR(255), @Element TINYINT)
RETURNS TABLE
AS
RETURN (
SELECT Element = NULLIF(SUBSTRING(@path, MIN(n)+1, MAX(n)-MIN(n)),'')
FROM (
SELECT
n, Item = ROW_NUMBER() OVER(ORDER BY (SELECT NULL))
FROM (
SELECT n = 0
UNION ALL
SELECT n
FROM (
SELECT TOP(LEN(@path)) n = ROW_NUMBER() OVER(ORDER BY (SELECT NULL))
FROM (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t1 (n),
(VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t2 (n)
) _tally
WHERE SUBSTRING(@path,n,1) = '\'
UNION ALL
SELECT n = LEN(@path)
) p
) q
WHERE Item = @Element OR Item = @Element+1
)
GO
SELECT Element FROM dbo.fn_get_folder ('c:\Programmefiles\Dicument\file1.txt',1)
I do now!!! π
"Try before you buy" π
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 7, 2016 at 9:42 am
ChrisM@Work (6/7/2016)
Sean Lange (6/7/2016)
ChrisM@Work (6/7/2016)
Sean Lange (6/7/2016)
Luis Cazares (6/7/2016)
Try this:
SELECT sys.fn_get_folder(path, 1)
LOL that is hilarious Luis. And it seems to have fooled Lowell and Chris too. That is too funny.
Haven't you got one of these Sean?
ALTER FUNCTION dbo.fn_get_folder
(@path VARCHAR(255), @Element TINYINT)
RETURNS TABLE
AS
RETURN (
SELECT Element = NULLIF(SUBSTRING(@path, MIN(n)+1, MAX(n)-MIN(n)),'')
FROM (
SELECT
n, Item = ROW_NUMBER() OVER(ORDER BY (SELECT NULL))
FROM (
SELECT n = 0
UNION ALL
SELECT n
FROM (
SELECT TOP(LEN(@path)) n = ROW_NUMBER() OVER(ORDER BY (SELECT NULL))
FROM (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t1 (n),
(VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t2 (n)
) _tally
WHERE SUBSTRING(@path,n,1) = '\'
UNION ALL
SELECT n = LEN(@path)
) p
) q
WHERE Item = @Element OR Item = @Element+1
)
GO
SELECT Element FROM dbo.fn_get_folder ('c:\Programmefiles\Dicument\file1.txt',1)
I do now!!! π
"Try before you buy" π
Already in production. As someone once said, "I don't often test my code, but when I do, I test in production.". π
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 7, 2016 at 9:45 am
ChrisM@Work (6/7/2016)
Eric M Russell (6/7/2016)
Jeff Moden (6/7/2016)
Eric M Russell (6/7/2016)
So I typically bypass the Programming 101 stuff and zoom in on what I really expect from senior level database developer.I do expect Senior level Database Developers to be able to do simple string manipulations even if they're a rocket scientist on other things.
Yeah, but basically anyone can do simple string manipulation; that's like a 7th grade homework assignment. I'd rather have a candidate explain to me why they wouldn't do string manipulation in a stored procedure. Then I feel comfortable having them code behind me.
Evidently not. I'd say this would make a pretty decent phone interview question.
For an online pre-interview test with 50 questions, something that the recruiter or HR requires the candidate to pass before the first interview is scheduled, then it's worth adding to the stack. However, if a candidate can't explain locking and isolation, or explain why referecning a function in a WHERE clause is a bad idea, or explain how a the GROUP BY..HAVING.. clause can be used to identify duplicate rows, then I couldn't care less about how proficient they are with string manipulation. In an interview, I don't bother with the pop-question stuff and instead focus on starting a two-way discussion about best practice topics that matter big picture; the type of stuff that can make or break or database server.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
June 7, 2016 at 9:55 am
Eric M Russell (6/7/2016)
Luis Cazares (6/7/2016)
Was I too late for April fools' day?This is what happens when you trust a forum to answer questions that you should answer on your own.
I could have given a real answer, but this is an example of the reasons behind my disclaimer. I wouldn't want someone that uses something without at least understanding how it works or at least point to some documentation for it.
If I was interviewing this person, I wouldn't mind if the answer is incorrect as long as it demonstrates knowledge on string manipulation and creativity to solve problems.
I personally would put string manipulation using T-SQL in the same category as programming a row-by-row cursor; I don't consider it to a core competency for a T-SQL developer. I'd ask questions about joining, grouping, ranking, indexing, isolation, and execution plans before I would test someone's knowledge about string manipulation, but then again I'm typically sitting in on a panel interview and can only ask maybe a half dozen questions. So I typically bypass the Programming 101 stuff and zoom in on what I really expect from senior level database developer.
It's a good topic for a forum discussion, I'm just saying it's not a good interview question within the context of a SQL Server Developer/DBA position.
I'd say it depends on what type of data you are working with in the database. Our main product has a lot of character/string data since it is a "reporting" database. Think intelligence and operational data generated from a combat environment. Not a lot of numeric data except where you are count kia/wia/mia numbers.
June 7, 2016 at 11:54 pm
Eric M Russell (6/7/2016)
ChrisM@Work (6/7/2016)
Eric M Russell (6/7/2016)
Jeff Moden (6/7/2016)
Eric M Russell (6/7/2016)
So I typically bypass the Programming 101 stuff and zoom in on what I really expect from senior level database developer.I do expect Senior level Database Developers to be able to do simple string manipulations even if they're a rocket scientist on other things.
Yeah, but basically anyone can do simple string manipulation; that's like a 7th grade homework assignment. I'd rather have a candidate explain to me why they wouldn't do string manipulation in a stored procedure. Then I feel comfortable having them code behind me.
Evidently not. I'd say this would make a pretty decent phone interview question.
For an online pre-interview test with 50 questions, something that the recruiter or HR requires the candidate to pass before the first interview is scheduled, then it's worth adding to the stack. However, if a candidate can't explain locking and isolation, or explain why referecning a function in a WHERE clause is a bad idea, or explain how a the GROUP BY..HAVING.. clause can be used to identify duplicate rows, then I couldn't care less about how proficient they are with string manipulation. In an interview, I don't bother with the pop-question stuff and instead focus on starting a two-way discussion about best practice topics that matter big picture; the type of stuff that can make or break or database server.
Yep agreed on all that... right along with simple string manipulation. π
--Jeff Moden
Change is inevitable... Change for the better is not.
June 7, 2016 at 11:59 pm
Eric M Russell (6/7/2016)
Jeff Moden (6/7/2016)
Eric M Russell (6/7/2016)
So I typically bypass the Programming 101 stuff and zoom in on what I really expect from senior level database developer.I do expect Senior level Database Developers to be able to do simple string manipulations even if they're a rocket scientist on other things.
Yeah, but basically anyone can do simple string manipulation; that's like a 7th grade homework assignment. I'd rather have a candidate explain to me why they wouldn't do string manipulation in a stored procedure. Then I feel comfortable having them code behind me.
Apparently, not such an easy question for the OP. π
So, you do no string manipulation in any of your stored procedures whatsoever?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 15 posts - 16 through 30 (of 111 total)
You must be logged in to reply to this topic. Login to reply