Viewing 15 posts - 2,581 through 2,595 (of 3,543 total)
Nice one roockmoose
Knew there was a way without convert but could not remember it
June 23, 2004 at 2:29 am
create function getMthEndDate (@date datetime)
returns datetime
as
begin
return DATEADD(d,-1,DATEADD(m,1,LEFT(CONVERT(varchar,@date,112),6)+'01'))
end
go
June 22, 2004 at 6:36 am
declare @wantednum varchar(10)
set @wantednum = '10'
select ID
from
where charindex(' ' + @wantednum + ' ',' ' + nums + ' ') > 0
Note that this...
June 22, 2004 at 6:26 am
on b.field1 = a.field - 1
should have been
on b.field1 = a.field1 - 1
If field1 is not int then you will have to cast the column to the correct data...
June 21, 2004 at 10:36 am
again this points to a data issue
run this
select [service date]
from
where [service date] > 0
and isdate([service date]) = 0
to what values sql considers not a date
June 21, 2004 at 7:42 am
You cannot convert character zero to a datetime.
You can convert integer zero to datetime as in
select cast(0 as datetime)
which will give you 1900-01-01 00:00:00.000
You will have to change zeros to...
June 21, 2004 at 6:41 am
Check that all your input data is formatted as yyyymmdd.
select cast(cast(20031224 as varchar) as datetime)
will work
select cast(cast(20032412 as varchar) as datetime)
will give conversion error
June 21, 2004 at 6:04 am
SELECT [Part#],
SUM(CASE WHEN MONTH([Replacement Date]) = 1 THEN [Replace Qty] ELSE 0 END) AS [Jan],
SUM(CASE WHEN MONTH([Replacement Date]) = 2 THEN [Replace Qty] ELSE 0 END)...
June 21, 2004 at 2:52 am
update a
set a.field2 = b.field2
from tablea a
inner join tablea b
on b.field1 = a.field - 1
where a.field2 is null
June 18, 2004 at 7:12 am
as per above, try this
declare @sql nvarchar(100), @idno int
set @sql = 'insert into ' + @databasename + '.dbo.tablea (cola,colb values (valuea,valueb) set @idno = SCOPE_IDENTITY()'
exec sp_executesql @sql,N'@idno int output',@idno...
June 18, 2004 at 6:39 am
DTS is Data Transformation Services and allows the copying and transformation of data between databases and or files.
BCP is Bulk Copy Program and allows the transfer (in or out) of data...
June 18, 2004 at 1:53 am
Try this
alter procedure prRecCount @vTbl varchar(25) as
declare
@sql varchar(2000),
@vCnt int
set @sql = 'select @vCnt = cnt from openquery( {servername},''select count(*) cnt from ' + @vTbl +''')'
exec sp_executesql @sql,
June 17, 2004 at 6:48 am
Not knowing what the output looks like but...
isql has a default output width of 80. If the output line is longer isql will split it into several lines.
So,
isql -Q "select...
June 17, 2004 at 6:37 am
I used to get this with SQL7.
I installed SQL7 SP4 and MDAC 2.7 (on both client and server) and problem went away.
June 17, 2004 at 6:18 am
Why not use DTS or BCP. You can schedule either in sql server agent.
June 17, 2004 at 6:06 am
Viewing 15 posts - 2,581 through 2,595 (of 3,543 total)