Viewing 15 posts - 1,861 through 1,875 (of 3,543 total)
Unless I missed something here
![]() | The column has a bit data type |
Therefore can only be null,0 ro 1
![]() | Dang... missed that one, David... nice catch. |
Thanks Jeff
But it is...
May 30, 2006 at 2:59 am
STUFF(STUFF(comment,CHARINDEX('Seam:',comment)+5,0,REPLICATE('0',8-(CHARINDEX('Roll:',comment)-CHARINDEX('Seam:',comment)))),8,0,REPLICATE('0',13-CHARINDEX('Seam:',comment)))
May 26, 2006 at 10:02 am
What values do you want from your example, eg to get the Bar Codes
STUFF(comment,1,CHARINDEX('Bar Code:',comment)+8,'')
May 26, 2006 at 7:15 am
Requirement is to show missing months as well
DECLARE @from datetime, @diff int
SELECT @from = DATEADD(month,DATEDIFF(month,0,MIN([Date])),0),
@diff = DATEDIFF(month,MIN([Date]),MAX([Date]))
FROM @Table
SELECT STUFF(CAST(d.[Date] as...
May 26, 2006 at 7:01 am
Yes it can have any number of input and output paramters
EXECUTE sp_executesql @strSQL, N'@x int OUTPUT,@y int OUTPUT', @x OUTPUT, @y OUTPUT
May 18, 2006 at 11:02 am
You can use an undocumented procedure
sp_msforeachtable 'SELECT ''?'',COUNT(*) FROM ?'
also you could create a temp table and insert the results to it
May 18, 2006 at 9:41 am
use sp_executesql instead
DECLARE @x INT
DECLARE @strSQL VARCHAR (2000)
DECLARE @dbname VARCHAR (50)
SET @dbname = 'A40001_1'
SET @strSQL = 'SELECT @x = MAX(Key_ID) FROM ' + @dbname + '.dbo.TableABC'...
May 18, 2006 at 9:34 am
Agree with Vladan
But if you must do this using a cursor then
DECLARE @sql nvarchar(4000)
SET @sql = 'DECLARE c CURSOR FOR SELECT...
May 18, 2006 at 9:31 am
SET @strSQL1 = 'SELECT t1.col1, t1.col2, t2.col3 FROM mytable t2 INNER JOIN ('
SET @strSQL2 = 'SELECT col1 AS col1, col2 AS col2'
SET @strSQL3 = ''
...code here to add...
May 18, 2006 at 8:42 am
You can EXEC more than 8000 chars by supplying more than one variable, eg
EXEC(sql1 + sql2 + sql3)
Why SLECT INTO ?
And why inside the EXEC ?
I just converted your...
May 18, 2006 at 7:45 am
DECLARE @start datetime, @end datetime
SET @start = DATEADD(month,DATEDIFF(month,0,GETDATE()),0)
SET @end = DATEADD(month,1,@start)
SELECT creative,COUNT(DISTINCT sessionid)
FROM [pagehits]
WHERE adate >= @start and adate < @end
GROUP BY creative
May 18, 2006 at 7:38 am
What datatype is YYYYMM and what format/datatype is 'current month'
Assuming, like Pam, that YYYYMM is char and 'current month' is the same format/type as YYYYMM then
DECLARE @start char(6)
SET @start =...
May 18, 2006 at 7:17 am
Viewing 15 posts - 1,861 through 1,875 (of 3,543 total)