Viewing 11 posts - 1 through 11 (of 11 total)
Hi!
Try this, without cursors.
Regards,
Liliana.
SELECT TOP 100 n = IDENTITY(INT, 1, 1) INTO #Numbers
FROM
sysobjects a1
CROSS JOIN
sysobjects a2
CROSS JOIN
...
January 15, 2009 at 4:55 am
Hi,
I think almost everything can be solved without a cursor, but only for give an answer to your question, try without ORDER BY... that is the reason.
Regards, an sorry my...
March 28, 2007 at 12:27 pm
Jesper,
Thank you very much for the code, it's great!
Liliana.
February 15, 2006 at 4:35 am
Hi,
This is the change to insert data in a new table, but it would be very interesting to have Jesper's suggest, without while or change table #test:
CREATE TABLE #test...
February 14, 2006 at 9:29 am
Hi,
Take a copy of your table before:
CREATE TABLE #test (name varchar(40), iq varchar (100))
INSERT #test SELECT 'Juan', '1 + 5<br>2 + 2<br>4 + 1<br>3 + 3<br>1 + 1'
INSERT #test SELECT...
February 13, 2006 at 10:57 am
Hi,
Try this:
DECLARE @article char(10)
DECLARE @maxarticle char(10)
SELECT @article = MIN(article) FROM #test
SELECT @maxarticle = MAX(article) FROM #test
DECLARE @society VARCHAR(8000)
WHILE @article <= @maxarticle
...
February 8, 2006 at 5:44 am
Hi,
Try this, so your code is independent from values. I suggest don't repeat ItemID in both tables, but if you do, this query will return Standard value.
SELECT O.OrderID,
O.ItemID,...
February 8, 2006 at 5:15 am
Hello,
Try with GO before UPDATE:
IF(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'mytable'
AND COLUMN_NAME = 'mycol'
) = 0
ALTER TABLE mytable ADD mycol int not NULL DEFAULT (0)
GO
UPDATE mytable SET mycol = myval
Liliana.
February 7, 2006 at 9:10 am
Hello,
Is not very difficult with dynamic sql and WHILE. Try:
-- Your table
CREATE TABLE TEST_COL
(Id smallint,
col1 smallint,
col2 smallint,
col3 smallint,
col4 smallint,
col5 smallint)
INSERT TEST_COL
SELECT 1, 11, 21, 31, 41, 51 UNION
SELECT 2,...
February 7, 2006 at 8:51 am
Ok, then:
set @CMD = 'INSERT INTO DBMON..Records (RunDate, DB, RecCount, TBName) Select GetDate(), ''' + @DB +''', rows, b.name FROM ' + @DB + '..sysindexes a , ' + @DB...
February 7, 2006 at 7:34 am
Hello,
Try:
set @CMD = 'INSERT INTO DBMON..Records (RunDate, DB, RecCount, TBName) Select(GetDate(), ''' + @DB +''', rows, b.name) FROM ' + @DB + '..sysindexes a , ' + @DB +...
February 7, 2006 at 6:52 am
Viewing 11 posts - 1 through 11 (of 11 total)