I interviewed 2 great SQL people in the last couple of days, read the two links below, you will enjoy it
Interview With Craig Freedman About Indexing, Query Plans And Performance
Interview With Erland Sommarskog About SQL Server and Transact SQL
Denis The SQL Menace
--------------------
SQL...
Interesting stuff
http://www.owasp.org/index.php/Testing_for_SQL_Server
How secure is your server?
Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
SQLBlog.com, Google Interview Questions
I did an interview with Stéphane Faroult about Refactoring SQL Applications. I think you will like it, you can find it here: Interview With Stéphane Faroult About Refactoring SQL Applications
Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning...
declare @Temp Table(data text)
Insert Into @Temp Values(replicate('1',5000))
select datalength(data) from @temp
go
this returns 5000
now if we replicate 50000 what does this return?
declare @Temp Table(data text)
Insert Into @Temp Values(replicate('1',50000))
select datalength(data) from...
Volunteer Moderators and Answerers who support the Microsoft MSDN SQL Server Forums have launched a Wiki with Solutions for Common T-SQL Problems.
Check it out here: http://code.msdn.microsoft.com/SQLExamples
Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks...
It has been a while since my last teaser but here we go
What do you think the following returns?
SELECT CONVERT(datetime,'1/1/1') -CONVERT(datetime,1) + CONVERT(datetime,0)
How about this on SQL Server 2008
SELECT...
Here is a small simple Thanksgiving teaser. What do you think will the result be of the select count query?
USE tempdb
GO
CREATE TABLE Customer (CustomerID INT PRIMARY KEY)
INSERT Customer VALUES (1)
INSERT Customer VALUES (2)
INSERT Customer VALUES (3)
INSERT Customer VALUES (4)...
I have interviewed Kalen Delaney about her latest book
Inside Microsoft SQL Server 2005 Query Tuning and Optimization
Check it out here Interview With Kalen Delaney About Inside Microsoft SQL Server 2005 Query Tuning and Optimization
I am reading the book now and must say it is pretty awesome...
Can you write code that proofs that @c and @b are the same value (0x1F40B33B42750DA9BBCD79F36728C7C9 )
declare @c varchar(34),
@b varbinary(16)
set @c = '0x1F40B33B42750DA9BBCD79F36728C7C9'
set @b = 0x1F40B33B42750DA9BBCD79F36728C7C9
Denis The SQL Menace
--------------------
SQL Server...
what does this display?
declare @d datetime
set @d = '20071010'
select dateadd(yy, datediff(yy, 0, @d)+1, -1)
Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
SQLBlog.com, Google Interview Questions
Here is a small teaser, can you guess the output?
SELECT d.c-d.b/d.a
FROM(SELECT 1,2,5)d(a,b,c)
Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
SQLBlog.com, Google Interview Questions
What will be the outcome of this script?
First we create a table with a total of 6000 bytes
Next we increase col2 from 1000 to 2000 bytes, this will give us a total of 7000 bytes
Finally we add col3 which has 1000 bytes, this will give us a total of 8000 bytes
First run these two statements...
Use this site to make sure you are not open to these nasty attacks!
http://ferruh.mavituna.com/makale/sql-injection-cheatsheet/
Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
SQLBlog.com, Google Interview Questions
This is for SQL Server 2000 only, SQL Server 2005 is a lot smarter which is another reason to upgrade.
When running the following query you probably already know that 2 is converted to an int datatype.
SELECT *
FROM Table
WHERE ID =2
What about the value 2222222222? Do you think since it...
without running this what will be the values of the ID2 column after creating a default with values?
create table def(id int ,id2 int)
INSERT def (id) VALUES(1)
INSERT def (id) VALUES(2)
INSERT def (id) VALUES(3)
SELECT * FROM def
ALTER TABLE def ADD CONSTRAINT
Dflt DEFAULT 500 FOR id2...
Do you know how NULLIF and non-deterministic functions work?
Run this first
CREATE TABLE #j (n varchar(15))
DECLARE @a int
SET @a = 1
WHILE @a <= 1000 BEGIN
INSERT #j
SELECT NULLIF(REPLICATE('1', RAND()*2) , ' ')
SET @a = @a + 1
END
Go
After that is done run this query
SELECT * FROM #j...
Watch and learn why you should always sanitize the input
http://uk.youtube.com/watch?v=MJNJjh4jORY
Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
SQLBlog.com, Google Interview Questions
it looks like SQL Server 2008 has nanosecond precision
if you run the following
DECLARE @t time
SELECT @t ='0:0'
SELECT @t AS Time1,dateadd(ms,1,@t) AS TimeMilli,
dateadd(ns,10000,@t) AS TimeNano1,dateadd(ns,100,@t) AS TimeNano2
The output is this
Time1 00:00:00.0000000
TimeMilli...
There are 10 new features in the latest SQL server 2008 CTP
I have put a list here: http://sqlservercode.blogspot.com/2007/08/sql-server-2008-july-ctp-has-been.html
Also SQL Server 2008 will NOT include Notification Services anymore, this has been deprecated
Denis The SQL Menace...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.