Viewing 15 posts - 16 through 30 (of 355 total)
There are several problems with your procedure and the "WHERE (1 = 1)" clause is not really one of them.
You should always declare the length of any varchar, nvarchar, char...
January 10, 2011 at 12:28 pm
Thanks Jeff for following this up.
--Andrew
January 10, 2011 at 5:58 am
If the column datatype is of character type
STUFF(MyColumn, 6, 0, '-')
If the column datatype is of integer type
STUFF(CAST(MyColumn AS varchar(10)), 6, 0, '-')
January 6, 2011 at 12:40 pm
Use RANK() instead of ROW_NUMBER()
RANK() OVER(ORDER BY Value) - 1
January 6, 2011 at 11:19 am
Assuming a table with this structure:
CREATE TABLE #MyTable (
equipment varchar(20) NOT NULL,
date_start datetime NOT NULL,
date_end datetime NOT NULL
)
And some test data...
January 5, 2011 at 4:28 pm
Narendra-274001
I just noticed the other thread in the T-SQL 2008 forum.
PLEASE don't cross post - you just waste people's time.
January 5, 2011 at 2:45 pm
Here's a script for providing data in an easily consumable format. I've made some assumptions about your table structure.
CREATE TABLE #MyTable (
ID INT NOT NULL PRIMARY KEY,
...
January 5, 2011 at 2:32 pm
Here's an alternative query based on method 2 of my previous post, but uses a recursive CTE instead of a WHILE loop. I haven't compared the various methods for performance.
DECLARE...
January 5, 2011 at 6:09 am
This isn't really something that TSQL is well suited for, since the various solutions require an iterative approach. However, if you want to find the modulus of a large integer...
January 4, 2011 at 12:45 pm
I'm not sure what you are trying to do. If you are trying to copy column values from one table to another where ID columns in the two tables match,...
December 24, 2010 at 2:55 am
You need a pivot query. You can use the PIVOT syntax or do something similar to the query below.
I've assumed this table structure, so you will have to adapt the...
December 23, 2010 at 12:34 pm
Sorry. - I just noticed that this is the Access forum. My comment above assumed it was for SQL Server. However, what I said should hopefully be relevant to Access,...
December 23, 2010 at 12:07 pm
Don't take those square brackets in the formal syntax description of INSERT in Books Online too literally, but if you insist on using table and column names with spaces (why?),...
December 23, 2010 at 12:02 pm
Are you interested in 2010 rows only if they match another 2009 row on the Value column? Or are you also interested in 2010 rows that have no matching 2009...
December 23, 2010 at 11:48 am
Jeff Moden (12/15/2010)
andrewd.smith (12/15/2010)
Jeff Moden (12/15/2010)
parthi-1705 (12/13/2010)
But i want to know only CEILING can do this or some other functions can do this or notThanks
Parthi
CEILING is the way people...
December 16, 2010 at 4:17 am
Viewing 15 posts - 16 through 30 (of 355 total)