Viewing 15 posts - 241 through 255 (of 267 total)
My VB isn't great but if you use OnError to trap the error, you can then include some specific error handling in VB to check for errors (Err.Number). You'll...
March 31, 2003 at 7:57 am
You can use @@error to determine if there is an error:
if @@error <> 0 begin
/* execute other statements and procedures in here */
end
Jeremy
March 31, 2003 at 6:20 am
I had a similar problem with temporary tables.
I had an sp which would loop round for each each month for 3 years worth of data and inserted output...
March 31, 2003 at 2:41 am
The easiet way to delete the whole of a table is:
truncate table @tablename
Jeremy
March 31, 2003 at 12:44 am
You can use:
net stop mssqlserver
net start sqlserver
in a .bat file executed using the at command to execute at a specific time....
March 28, 2003 at 8:31 am
Use the char function:
patindex(@value,char(9)) - tab
patindex(@value,char(13)) - newline
I think new line is 13 but it might be...
March 27, 2003 at 4:49 am
If both fields are int then the result would be a int.
SELECT Stage2file.newdist AS newdist,
CAST(convert(decimal(10,2),distdlrcnt))/distcnt AS Prop_DD
INTO dbo.rdddf2
FROM dbo.Stage2file
join
dbo.Stage3file
ON Stage2file.newdist = Stage3file.newdist
Jeremy
March 27, 2003 at 4:28 am
This should work but no guarantees on performance:
CREATE FUNCTION fn_charlist (@str varchar(200), @delimeter char(1) =',', @sequence int)
RETURNS varchar(200)
AS
BEGIN
declare @position smallint, @tempvar varchar(4000), @counter int, @continue...
March 27, 2003 at 4:22 am
No, you could not use this, as it stands, in a select statement.
It might be possible to create a user defined function to do this but I'm not...
March 27, 2003 at 3:58 am
Michael,
Try this:
CREATE PROCEDURE [dbo].[charlist]
@field_value varchar(4000), @delimeter char(1) =',', @sequence int, @output_val varchar(255) OUTPUT
AS
declare
@position smallint, @tempvar varchar(4000), @counter int, @continue...
March 27, 2003 at 3:21 am
I cannot think of any other way of summing the rows until you reach a set number other than processing each row at a time. Maybe someone else does...
March 27, 2003 at 2:58 am
David,
Thanks for the idea.
I was doing some more checking after I made the post and I'm not sure what is going on now.
I simulated what I thought was going on...
March 27, 2003 at 1:53 am
I use dynamic SQL to create code based on parameters. For example:
create procedure testsql @colname varchar(25), @tablename varchar(25) as
declare @sqlstring nvarchar(200)
set @sqlstring = N'select ' + @colname +N'
from '...
March 27, 2003 at 1:37 am
Two ideas.
1. Change the destination table to accept nulls.
2. Use isnull to replace the nulls with another value:
select isnull(column_name,replacement_value)
from tablename
Jeremy
March 26, 2003 at 6:25 am
Viewing 15 posts - 241 through 255 (of 267 total)