Viewing 15 posts - 256 through 270 (of 430 total)
Little better
DECLARE @aa INT SET @aa = 2
SELECT Funds, Subscriber, SUM(Amount) FROM #tblTempRetros A
WHERE
@aa > (SELECT COUNT(DISTINCT DateMonthEnd)
FROM
#tblTempRetros B
WHERE
B.DateMonthEnd > A.DateMonthEnd)
GROUP BY Funds, Subscriber
I should have taken my time. I didn't...
July 9, 2005 at 8:09 pm
DECLARE @aa INT SET @aa = 3
SELECT Funds, Subscriber, SUM(Amount)
FROM
#tblTempRetros MyTable
JOIN
(SELECT DISTINCT DateMonthEnd FROM #tblTempRetros A
WHERE
@aa - 1 = (SELECT COUNT(DISTINCT DateMonthEnd)
FROM
#tblTempRetros B
WHERE
B.DateMonthEnd > A.DateMonthEnd)) MyDate
ON
MyTable.DateMonthEnd >= MyDate.DateMonthEnd
GROUP BY Funds, Subscriber
July 9, 2005 at 8:03 pm
sp_help tablename
will list all table properties including index details. Creating an index will not help you in this problem unless you have a data in datafile which can be in...
July 7, 2005 at 11:13 am
If the table has a clusterd index the order will change as expected. If there is no index then we can never predict the order of storage.
July 7, 2005 at 10:54 am
I am not sure whether it would be possible to retain the order with bcp itself.
The workaround is edit the data file by appending row number with the help of...
July 7, 2005 at 8:56 am
There may be rows with nonumeric values in the column in question.
check
SELECT SCRCTG, * FROM tblIntelecDownload
WHERE
ISNUMERIC(SCRCTG) = 0
Good idea Remi
July 5, 2005 at 2:01 pm
I don't get it if you don't know the server names you cannot have it as linked server. So ServerName.DataBaseName.dbo.ObjectName will not work.
You should be knowing the database names in...
July 5, 2005 at 8:23 am
You can get constraint names from sysreferences, sysindexes, sysconstraints table.
Easy way is use sp_help tablename. All constraints will be listed. Then use ALTER TABLE DROP CONSTRAINT to drop them.
or...
July 5, 2005 at 8:08 am
Check ALTER TABLE in bol.
BEGIN TRANSACTION
ALTER TABLE dbo.[Primary]
DROP CONSTRAINT PK_Primary
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.[Foreign]
DROP CONSTRAINT FK_Foreign_Primary
GO
COMMIT
It is not possible to drop all constraints in a single statement.
July 5, 2005 at 7:20 am
1. You cannaot refer to a temptable in tempdb by prefixing tempdb.dbo. (If you check tempdb sysobjects you will see #table name will be different like #tablename_________12121)
2. To get fixed...
July 5, 2005 at 6:41 am
As Michael pointed it is outf scope. Your dynamic statements will have a seperate scope that the connection you are in.
if you want to do it Dynamic do it thsi...
July 2, 2005 at 5:20 am
More possible formats
DECLARE @Month TABLE (MonthVal VARCHAR(10))
INSERT @Month VALUES ('MM')
INSERT @Month VALUES ('M')
INSERT @Month VALUES ('Mon')
INSERT @Month VALUES ('Month')
DECLARE @Year TABLE (YearVal VARCHAR(10))
INSERT @Year VALUES ('YYYY')
INSERT @Year VALUES ('YY')
INSERT...
June 30, 2005 at 8:09 pm
You cannot use SP there. Create a function which returns the value and use it in the View.
If you have SQL Server 7.0 or less you convert your view into...
June 30, 2005 at 10:05 am
DECLARE @sql VARCHAR(2000)
SELECT @sql = 'CREATE TABLE ' + @FileName + '(Phone VARCHAR(10) )'
EXEC(@SQL)
Thanks AJ Ahrens I did not take the question.
June 30, 2005 at 9:59 am
That is because you already declared @FileName as VARCHAR(20). Change the name of any one of this you will be okay.
June 30, 2005 at 9:44 am
Viewing 15 posts - 256 through 270 (of 430 total)