Viewing 15 posts - 2,551 through 2,565 (of 3,544 total)
DECLARE @monthnumber int
SET @monthnumber = 9
SELECT DATENAME(month,DATEADD(month,@monthnumber - 1,0))
Far away is close at hand in the images of elsewhere.
Anon.
September 1, 2004 at 6:54 am
SELECT *
INTO tableone
FROM tablezero
NOTE
1. Select into/Bulk copy option must be set for database
2. Primary Keys and Indexes will not be created for new table
Alternatively
CREATE TABLE tableone (col1,...
Far away is close at hand in the images of elsewhere.
Anon.
September 1, 2004 at 6:46 am
Not that I know of but you could write one like this
CREATE FUNCTION fn_hextovarchar
(@input varchar(8000), @startoffset int = 1)
RETURNS varchar(4000)
AS
BEGIN
DECLARE @hex char(16),@output varchar(4000),@ptr int,@val int
SET @hex...
Far away is close at hand in the images of elsewhere.
Anon.
August 6, 2004 at 7:09 am
Divide by zero always returns null, the combination of ANSI_WARNINGS, ARITHABORT and ARITHIGNORE determines whether an error is produced or at what level the abort takes place (see BOL)
So
SET ANSI_WARNINGS OFF
SET...
Far away is close at hand in the images of elsewhere.
Anon.
August 6, 2004 at 6:36 am
Use a FormatFile to specify the order and type of input data and in which columns to place the data. Note that any column not specified must be nullable.
BOL has...
Far away is close at hand in the images of elsewhere.
Anon.
August 4, 2004 at 7:15 am
In ExecuteSQL task, RAISERROR will cause the 'On Failure' workflow to trigger. eg
IF NOT EXISTS (SELECT 1 FROM [sometable] WHERE [sometest])
RAISERROR 'Record Does Not Exist',16,1
Far away is close at hand in the images of elsewhere.
Anon.
August 3, 2004 at 7:13 am
If the data is sorted on a column with unique values then you can do the following (uses pubs for example)
select (select count(*)
from pubs.dbo.stores s2
where s2.stor_id...
Far away is close at hand in the images of elsewhere.
Anon.
August 3, 2004 at 7:05 am
Increase the size of @Courses. It must be large enough to hold all the database names (including a comma) plus the final comma.
This is how I do .NET
Public...
Far away is close at hand in the images of elsewhere.
Anon.
August 2, 2004 at 9:29 am
Try this
alter procedure sp_GetUserValidation
(
@UserName varchar(50),
@Courses varchar(50),
@Return varchar(150) OUTPUT
)
AS
SET NOCOUNT ON
DECLARE @CourseName varchar(100), @UserValArray varchar(200), @Pos int
DECLARE @sql nvarchar(500)
DECLARE @Result char(1)
SET @Return = ''
SET @Courses = LTRIM(RTRIM(@Courses))
IF @Courses = '' RETURN
SET...
Far away is close at hand in the images of elsewhere.
Anon.
August 2, 2004 at 7:03 am
Yes I would be interested as well. The OR method is the way I do it, the ISNULL I got from other threads on this site and seemed a simpler neater...
Far away is close at hand in the images of elsewhere.
Anon.
August 2, 2004 at 2:49 am
If you have SQL2000, create a function
CREATE Function dbo.fn_table1 (@col1 int)
RETURNS varchar(1000)
AS
BEGIN
DECLARE @result varchar(1000)
SELECT @result = COALESCE(@result + ', ','') + CAST(NewCol1 as varchar)
FROM...
Far away is close at hand in the images of elsewhere.
Anon.
July 30, 2004 at 7:21 am
where col1 = isnull(@p1,col1)
and col2 = isnull(@p2,col2)
and col3 = isnull(@p3,col3)
But beware this will invoke a table or index scan.
Far away is close at hand in the images of elsewhere.
Anon.
July 28, 2004 at 7:23 am
UPDATE p
SET p.EmployeeNo = i.EmployeeNo
FROM [primary] p
INNER JOIN [import] i
ON i.LastName = p.LastName
AND i.Initial = LEFT(p.FirstName,1)
WHERE p.EmployeeNo IS NULL
BUT BEWARE! This will...
Far away is close at hand in the images of elsewhere.
Anon.
July 23, 2004 at 6:36 am
Firstly I would remove the subqueries from the while statements and do them once at the beginning, ie
declare @maxdataid int, @maxruleid int
select @maxdataid = isnull(max([id]),0) from newdata
select @maxruleid = isnull(max([id]),0)...
Far away is close at hand in the images of elsewhere.
Anon.
July 21, 2004 at 6:13 am
Created on the fly no testing
Probable poor performance
Assumes complete sql (including rules/test) less than 4000 bytes
CREATE TABLE #tests (rowid int IDENTITY(1,1),test nvarchar(100))
INSERT INTO #tests (test) values ('where rule1')
INSERT...
Far away is close at hand in the images of elsewhere.
Anon.
July 20, 2004 at 8:56 am
Viewing 15 posts - 2,551 through 2,565 (of 3,544 total)