Viewing 15 posts - 151 through 165 (of 907 total)
Not sure what you are referring to, but it depends on what you want. DATELENGTH returns the number of bytes, where as LEN returns the number of characters.
Gregory Larsen,...
September 23, 2003 at 7:30 am
Problems solved. I ran a maintenance plan. Tomorrow, I'll figure out exactly which DBCC solved my problem, and let everyone know.
Gregory Larsen, DBA
If you looking for SQL Server...
September 22, 2003 at 5:24 pm
Basically I want to release the pages that don't contain any records back to the database. Reason is because at one time these tables had a lot of records,...
September 22, 2003 at 5:20 pm
Might try something like:
Update MyTable
set colA = substring(colB,3,size(colB))
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
September 22, 2003 at 1:55 pm
Thats what I thought, so try this:
SELECT REPLACE(CONVERT(char(10), DATEADD(day, CAST(JULIAN_DAY AS int) - 1, CAST(cast([YEAR] as char) + '-01-01' AS datetime)), 101), '/', '') AS MMDDYYYY
FROM ISCFINAL2_POINT
WHERE ([YEAR] = '1964')
Gregory...
September 17, 2003 at 4:34 pm
When I mean is you can pass parmaters like this:
declare @x nvarchar(4000)
set @x = 'SELECT * FROM sysobjects where name = @name'
exec sp_executesql @x ,N'@x nvarchar(4000), @name nvarchar(100)',@x=@x,@name=N'sysobjects'
exec sp_executesql...
September 17, 2003 at 3:57 pm
Not sure about that error.
What are the data types and lengths for JULIAN_DAY and YEAR?
Are you sure all your data in these columns contains integers?
Gregory Larsen, DBA
If you looking for...
September 17, 2003 at 3:41 pm
What does your code look like As far as learning I would suggest you find a good book with lots of T-SQL examples. Possibly:
http://www.sqlserverbyexample.com/
Gregory Larsen, DBA
If you looking...
September 17, 2003 at 3:25 pm
Yes you can also do what J. Moseley
is suggesting. One advantage I can see in using sp_executesql is you can pass and return parameters from the dynamic SQL. ...
September 17, 2003 at 3:18 pm
Try something like this:
declare @jdate char(7)
set @jdate = '2003260'
select convert(char(10),
dateadd(day,cast(substring(@jdate,5,7) as int)-1,cast(substring(@jdate,1,4) + '-01-01' as datetime))
, 101)
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at...
September 17, 2003 at 2:41 pm
Sure! I think the where clause is what you are looking for:
select replace(convert(char(10),
dateadd(day,cast(jday as int)-1,cast(jyear + '-01-01' as datetime))
, 101),'/','') as MMDDYYYY
from mytable
where jyear = '2003'
Now if...
September 17, 2003 at 2:39 pm
Here try some thing like this.
declare @x nvarchar(4000)
declare @y nvarchar(4000)
declare @z nvarchar(4000)
set @x = 'SELECT ''Place first 4000 characters here, '
set @y = 'second 4000 here,'
set @z...
September 17, 2003 at 2:34 pm
Maybe these examples will help. There is a 1, 11, 245,365, 366 for Julian Day.
declare @jday varchar(3)
declare @jyear varchar(4)
set @jday = '245'
set @jyear = '2000'
select replace(convert(char(10),
dateadd(day,cast(@jday as int)-1,cast(@jyear +...
September 17, 2003 at 1:45 pm
Or to retrieve the last record by myid issue:
select * from mytable where myid = (select max(myid) from mytable)
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my...
September 17, 2003 at 10:38 am
Something like this might work for you:
declare @jdate char(7)
set @jdate = '2003226'
select convert(char(10),
dateadd(day,cast(substring(@jdate,5,7) as int)-1,cast(substring(@jdate,1,4) + '-01-01' as datetime))
, 101)
Gregory Larsen, DBA
If you looking for SQL Server Examples check out...
September 17, 2003 at 10:21 am
Viewing 15 posts - 151 through 165 (of 907 total)