Viewing 15 posts - 1,966 through 1,980 (of 3,544 total)
Beware of rounding, ie
DECLARE @number numeric(9,5)
SET @number = 60.99999
SELECT @number,CAST(@number AS numeric(6, 2))
result
60.99999 61.00
SELECT @number,CAST(ROUND(@number,2,1) AS numeric(6, 2))
result
60.99999 60.99
Far away is close at hand in the images of elsewhere.
Anon.
March 7, 2006 at 7:05 am
Just to pitch in ![]()
SELECT CAST([columnname] as varbinary(8000))
will display the string in hex and you can see what and how many non printable...
Far away is close at hand in the images of elsewhere.
Anon.
March 7, 2006 at 6:56 am
CREATE TABLE #temp (location int, [name] varchar(40), DOB datetime)
INSERT INTO #temp (location, [name], DOB)
SELECT location, [name], DOB
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;HDR=YES;Database=C:\temp\book1.xls', [sheet1$])
DECLARE @location int
SELECT @location =...
Far away is close at hand in the images of elsewhere.
Anon.
March 3, 2006 at 7:34 am
or use BCP
exec master..xp_cmdshell 'bcp database.owner.tablename out outputfilename -c -t "," -S servername -T'
Far away is close at hand in the images of elsewhere.
Anon.
March 3, 2006 at 7:24 am
in TSQL
INSERT INTO
OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;HDR=YES;Database=C:\temp\book2.xls', [sheet1$])
(location, [name], DOB)
SELECT location, [name], DOB
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;HDR=YES;Database=C:\temp\book1.xls', [sheet1$])
WHERE location = 'locationwanted'
the only caveat with this method is...
Far away is close at hand in the images of elsewhere.
Anon.
March 3, 2006 at 7:13 am
Try this
osql -S <server> -E -b -m-1 -i <not_changeable_sql_script.sql> -o <output>
IF ERRORLEVEL 1 GOTO ERROR_LABEL
Far away is close at hand in the images of elsewhere.
Anon.
March 3, 2006 at 7:01 am
WHERE @col1 LIKE 'abc_def'
Far away is close at hand in the images of elsewhere.
Anon.
March 2, 2006 at 6:37 am
| ...but your solution uses some implicit assumptions that are not given ... |
But your observations are assumptions also,...
Far away is close at hand in the images of elsewhere.
Anon.
March 1, 2006 at 3:52 pm
UPDATE a
SET a.[Scheduled Amount] = a.[Scheduled Amount] + CASE WHEN (@Qty - b.Summ) > (a.Quantity - a.[Scheduled Amount]) THEN (a.Quantity - a.[Scheduled Amount]) ELSE (@Qty - b.Summ - a.[Scheduled...
Far away is close at hand in the images of elsewhere.
Anon.
March 1, 2006 at 9:06 am
No problem ![]()
I had to look twice myself just to make sure ![]()
Far away is close at hand in the images of elsewhere.
Anon.
March 1, 2006 at 8:37 am
| A little tweak to seems (to me) to meet all the requirements (including the priority one)... |
My solution...
Far away is close at hand in the images of elsewhere.
Anon.
March 1, 2006 at 8:22 am
a possible solution
DECLARE @Material NVarChar(32), @Qty int
SET @Material = 'MATERIAL1'
SET @Qty = 350
UPDATE a
SET a.[Scheduled Amount] = CASE WHEN (@Qty - b.Summ) > a.Quantity THEN a.Quantity ELSE (@Qty -...
Far away is close at hand in the images of elsewhere.
Anon.
March 1, 2006 at 7:16 am
Just guessing
but I think the problem is the join between PartRace and IndResults not matching on RaceID
SELECT p.ParticipantID, pr.Age, ir.FnlTime, e.EventDate
FROM Participant p...
Far away is close at hand in the images of elsewhere.
Anon.
March 1, 2006 at 6:26 am
Could use if int (if not int then STR will round)
REPLACE(STR(Amount,13,0),' ','0')
or with decimal point
REPLACE(STR(Amount,13,2),' ','0')
or without decimal point but including decimal part
STUFF(REPLACE(STR(Amount,14,2),' ','0'),12,1,'')
Far away is close at hand in the images of elsewhere.
Anon.
February 28, 2006 at 7:23 am
If the fields are varchar then
create the numbers table thus
CREATE TABLE [numbers] (number int PRIMARY KEY CLUSTERED)
and populate with numbers from 1 to 8000
and use
DECLARE @result varchar(8000)
SET @result...
Far away is close at hand in the images of elsewhere.
Anon.
February 28, 2006 at 7:13 am
Viewing 15 posts - 1,966 through 1,980 (of 3,544 total)