Viewing 15 posts - 781 through 795 (of 897 total)
I think it should be
Select IDENTITY(Numeric, @MAX_ID, 1) AS RowNum, * into #t2 from #t1
April 13, 2010 at 3:45 am
This does work in my machine. Check the alias name given to COUNT(*) field.
DECLARE @strColumnName VARCHAR(100)
DECLARE @strTableName VARCHAR(100)
DECLARE @strColumnValue VARCHAR(100)
DECLARE @strSQL ...
April 12, 2010 at 7:25 am
Add this block above the EXECUTE( @strSQL ) statement
SET@strSQL = ' SELECT * '
+ ' FROM ( ' + @strSQL + ' ) T '
+ ' WHERE Count > 0...
April 12, 2010 at 7:06 am
This should help..
DECLARE@strColumnNameVARCHAR(100)
DECLARE@strTableNameVARCHAR(100)
DECLARE@strColumnValueVARCHAR(100)
DECLARE@strSQLVARCHAR(MAX)
SET@strColumnName = 'EmployeeID'
SET@strTableName = 'mstEmployees'
SET@strColumnValue= 6
SELECT@strSQL = COALESCE( @strSQL + ' UNION ALL ' + CHAR(10), '' )
+ ' SELECT''' + OBJECT_NAME( FK.fkeyid ) + ''' TableName, COUNT(*)...
April 12, 2010 at 6:11 am
Trouble Shooter (4/12/2010)
Hi,Can u delete two duplicate row using row_number function
if yes ,please let me know
Yes, it does. It can delete any number of rows.
Try this
DECLARE@tblTable TABLE
(
Col1 INT
)
INSERT@tblTable
SELECT1 UNION ALL
SELECT1...
April 12, 2010 at 1:39 am
Trouble Shooter (4/12/2010)
Hi,2 is the variable only.
u can set any value there like 1 ,3 etc as per your requirement.
But, don't you think the method would be a bit tedious....
April 12, 2010 at 1:30 am
Trouble Shooter (4/12/2010)
Hi ,Did u try it Mr. SSCertifiable ?
Look at this buddy
rajagopalanseeth (3/29/2010)
April 12, 2010 at 12:35 am
You can use the ROW_NUMBER() function. It would have been helpful if you would have given us the table structure and some sample data to work with.
April 10, 2010 at 12:03 pm
Glad to help you out:-)
April 9, 2010 at 3:18 am
This should help you out..
DECLARE @tblTable TABLE
(
AN_CODE1 VARCHAR(50),
AN_CODE2 VARCHAR(50),
[VALUE] INT
)
INSERT @tblTable
SELECT 'CAP', 'ENERGY1', 200 UNION ALL
SELECT 'CUR', 'ENERGY1', 400
SELECTAN_CODE2,
SUM( CASE WHEN AN_CODE1 = 'CAP' THEN [VALUE] ELSE 0 END )...
April 9, 2010 at 2:03 am
chandrasekaran.ganapathy (4/8/2010)
Got it. I have read some article. So If i make a query like
Select * from employeeId where employeeId between 'xxxxxx' and 'xxxx'
or
Select * from...
April 9, 2010 at 12:30 am
My method makes use of ROW_NUMBER() and NEWID(), ROW_NUMBER() a ranking function and NEWID() a function that returns a unique value for every row in the result. You can Google...
April 8, 2010 at 7:01 am
You can never execute an Index. To get the data you will have to always SELECT * from the table.
And one more thing, is you get some script from somewhere...
April 8, 2010 at 6:45 am
Looks like too much of code to me too. But this works
IF OBJECT_ID( 'tempdb..#tmpOrdered' ) IS NOT NULL
DROP TABLE #tmpOrdered
DECLARE@tblTable TABLE
(
FranchiseID INT,
SectorID INT
)
INSERT@tblTable
SELECT 1,...
April 8, 2010 at 6:33 am
Trybbe (4/8/2010)
Msg 544, Level 16, State 1, Line 2
Cannot insert explicit value for identity column in table 'Clusters' when IDENTITY_INSERT is set to OFF.
the query I tried is:
Insert into Areas
Select...
April 8, 2010 at 5:36 am
Viewing 15 posts - 781 through 795 (of 897 total)