Viewing 15 posts - 46 through 60 (of 81 total)
Looking for this query.
SELECT DISTINCT Owner,PropertyId FROM #Table
September 29, 2006 at 6:28 pm
Try this out
DECLARE @Rows INT
SELECT @Rows = 200
-- Replace @tbl with your actual tablename
SELECT A.*
FROM @tbl AS A
LEFT JOIN (
SELECT ProjId,
MIN(EmailId) AS MinId,
MAX(EmailId) AS MaxId,
COUNT(ProjId) AS RCnt
FROM @tbl
GROUP BY ProjId
 
September 29, 2006 at 6:18 pm
Hi
SELECT REPLACE(CONVERT(VARCHAR(10),GETDATE(),120),'-','')
Ram
September 29, 2006 at 9:53 am
May be just give a try.
USE NorthWind
GO
DECLARE @tblName VARCHAR(35)
SELECT @tblName = 'Products'
SELECT [DeclareStmt] = RTRIM('DECLARE @'+C.[Name]+SPACE(CharLen-LEN(C.[Name]))+CHAR(9)
+CASE WHEN T.[Name] IN ('SMALLDATETIME','DATATIME','TEXT','IMAGE','BIT','NTEXT','UNIQUEIDENTIFIER',
'BIGINT','INT','SMALLINT','TINYINT','MONEY','SMALLMONEY')
THEN UPPER(T.[Name])
WHEN T.[Name] IN ('DECIMAL','NUMERIC')
THEN UPPER(T.[Name]) + + '('...
September 29, 2006 at 7:37 am
May be just give a try.
USE NorthWind
GO
DECLARE @tblName VARCHAR(35)
SELECT @tblName = 'Products'
SELECT [DeclareStmt] = RTRIM('DECLARE @'+C.[Name]+SPACE(CharLen-LEN(C.[Name]))+CHAR(9)
+CASE WHEN T.[Name] IN ('SMALLDATETIME','DATATIME','TEXT','IMAGE','BIT','NTEXT','UNIQUEIDENTIFIER',
'BIGINT','INT','SMALLINT','TINYINT','MONEY','SMALLMONEY')
THEN UPPER(T.[Name])
WHEN T.[Name] IN ('DECIMAL','NUMERIC')
THEN UPPER(T.[Name]) + + '('...
September 29, 2006 at 7:37 am
Try this.
declare @tablename varchar (100)
set @tablename = '#BackupFile_' + replace(replace(cast(getdate() as varchar),' ',''),':','')
select @tablename
EXEC ('CREATE TABLE '+@tablename+ '([name] [nvarchar] (100))')
Ram
September 29, 2006 at 4:50 am
Thanks Sergiy! Good catch
Ram
September 29, 2006 at 4:46 am
INSERT INTO table variable from EXEC not allowed. It can be done on Temptables.
Try this out
DECLARE @InstanceDB as varchar(100)
CREATE TABLE #InstanceTable (Code varchar(100),FinancialYear varchar(100),ServiceID int)
---DECLARE @InstanceTable TABLE (Code varchar(100),FinancialYear varchar(100),ServiceID...
September 29, 2006 at 3:40 am
You may try like this...
DECLARE @VAL VARCHAR(10)
SELECT @VAL =''
SELECT @VAL =NULL
SELECT CASE WHEN (LEN(LTRIM(RTRIM(@VAL))) = 0 OR @val IS NULL) THEN '1999-01-01' ELSE @val END
September 28, 2006 at 8:12 am
Try this!
BEGIN
SET NOCOUNT ON
DECLARE @vuser VARCHAR(20)
DECLARE @tbl TABLE
([Id] VARCHAR(20),
WCode INT,
Reason VARCHAR(10),
HCode VARCHAR(10),
Loc VARCHAR(10))
SELECT @vuser = ''
INSERT INTO @tbl VALUES ('user1',125,'rsn1','cd1','loc1')
INSERT INTO @tbl VALUES (NULL,128,'rsn3','cd27','loc3')
INSERT INTO @tbl...
September 28, 2006 at 8:02 am
Try this out
BEGIN
SET NOCOUNT ON
DECLARE @vuser VARCHAR(20)
DECLARE @tbl TABLE
([Id] VARCHAR(20),
WCode INT,
Reason VARCHAR(10),
HCode VARCHAR(10),
Loc VARCHAR(10))
SELECT @vUser = ''
INSERT INTO @tbl VALUES ('user1',125,'rsn1','cd1','loc1')
INSERT INTO @tbl VALUES (NULL,128,'rsn3','cd27','loc3')
INSERT INTO @tbl VALUES (NULL,721,'rsn3','cd4','loc5')
INSERT INTO @tbl VALUES ('user2',122,'rsn3','cd1','loc3')
INSERT INTO @tbl VALUES...
September 28, 2006 at 7:42 am
It does not work that way!!
[Microsoft Excel] = COUNT(CASE WHEN SoftWare = 'Microsoft Excel' THEN SoftWare ELSE NULL END),
This one might work for you
SET NOCOUNT ON
DECLARE @tbl...
September 26, 2006 at 8:46 pm
You may try like this too..
SELECT [User] AS UserName
[MicrosoftExce] = CASE WHEN Max(SoftWare) = 'Microsoft Excel' THEN COUNT(Max(SoftWare)) ELSE 0 END,
[MicrosoftAccess] = CASE WHEN Max(SoftWare) = 'Microsoft Accessl' THEN COUNT(Max(SoftWare)) ELSE...
September 26, 2006 at 8:09 pm
INSERT INTO TableOne (AcctNo)
SELECT AcctNo
FROM TableTwo AS B
WHERE NOT EXISTS (SELECT 1 FROM TableOne AS A WHERE A.AcctNo = B.AcctNo)
September 26, 2006 at 2:10 pm
Viewing 15 posts - 46 through 60 (of 81 total)