Could someone please explain to me the difference in how a stored proc runs compared to just raw sql outside of a stored proc?
I created a query which creates 2 temp tables and loads them with data, then creates a 3rd temp table, inserts some rows with titles in the first column, and populates...
Hi Guys,
I'm hoping someone can help here because this has caused a lot of head scratching over the past few weeks.
I know of the PIVOT function to switch rows into columns, but this means the columns also become rows, therefore the row number is fixed, I would like to create a report that will...
Hi there,
I'm trying to insert a TAB into my output in SQL Server 2005 but it just represents it as a SPACE.
First I tried the following syntax with the TAB manually put in the string:
SELECT 'test1 test2'
And also using CHAR(9) like:
SELECT 'test1' + CHAR(9) + CHAR(9) + CHAR(9) + CHAR(9) +...
When and why would you ever use 'cast' over 'convert'?
I presume there is a slight difference in speed as cast doesn't do quite as much as convert, but surely the difference would be so small that it is insignificant.
Would you only use cast to make scripts more portable for other SQL...
Im trying to get the date of the previous day as specified at code level (i have a form for each day of the week so it will change from form to form).
Basically I want a variable containing the date of the previous monday for example (but could be any day), including today, so if this is monday...
Why are GOTO statements bad?
I've been writing SQL without any GOTO statements but recently became aware that they can be used in SQL Server 2005, but when I try to research it, people just flame the use of it.
Everyone says it's bad practice, and there are almost always more elegant...
What does N do? I'm looking at some code which I understand for the most part, but if I were writing it I wouldnt use N in it, I don't know what N does so was just wondering if someone could explain it to me please.
EXAMPLE:
SELECT * FROM sys.objects WHERE type IN (N'P', N'PC')
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.