Viewing 15 posts - 1 through 15 (of 47 total)
Here is simple way of getting the output.
declare @LotNo table (id int identity(1,1),LotNo varchar(50) Null)
insert into @LotNo
select 'A'
union all
select 'B'
union all
Select 'C'
union all
select 'D'
union all
Select 'E'
union all
select 'F'
union...
December 16, 2015 at 6:42 am
Hi,
As per your input the other sets should come like
2000022, 2001770, 2001771
2000022, 2001527, 2001528
Above result set dosen't have 2002005. so no result
-----
declare @bom table ([BOM Number] varchar(max),[Mat Number] varchar(max))
insert...
July 3, 2014 at 7:55 am
Please test the following .
select
[CampusID]
,[Campus]
,[TermID]
,[Term]
,[StudentID]
,[Qualification]
,[Programme]
,[status]
,[value]
from
(
SELECT
[CampusID]
,[Campus]
,[TermID]
,[Term]
,[StudentID]
,[Qualification]
,[Programme]
,[Repeat1stYear]
,[Repeat2ndYear]
,[Repeat3rdYear]
,[ProgTo2ndYear]
,[ProgTo3rdYear]
,[ProgToCompleteQual]
,[NotReturn2ndYr]
,[NotReturn3rdYr]
,[NotReturn4thYr]
FROM [dbo].[MyTable]
)p
unpivot (value for [status]in
(
[Repeat1stYear]
,[Repeat2ndYear]
,[Repeat3rdYear]
,[ProgTo2ndYear]
,[ProgTo3rdYear]
,[ProgToCompleteQual]
,[NotReturn2ndYr]
,[NotReturn3rdYr]
,[NotReturn4thYr]
))as unpvt
ORDER BY studentid, termid
Regards
J. Siva Kumar
April 15, 2014 at 5:57 am
--method1:
insert into table_c
select a.* from table_a a join table_b b
on a.id = b.id
-- method2
insert into table_c
select a.* from table_a a
where exists (select 1 from table_b b where...
April 3, 2014 at 6:04 am
alter table table add slno bigint identity(1,1)
regards
J Siva Kumar
March 28, 2014 at 4:40 am
SELECT 'SO-123456' AS OrderNo into #test
UNION ALL
SELECT 'SO-123456-01'
UNION ALL
SELECT 'SO-123456-2'
UNION ALL
SELECT 'SO-123457'
UNION ALL
SELECT 'SO-123457-1'
UNION ALL
SELECT 'SO-123457-02'
UNION ALL
SELECT 'SO-123458'
union all
select 'SO-123459=02'
select * from #test where OrderNo like '%[^A-Z]-[0-9]%'
DROP table #test
March 28, 2014 at 1:24 am
Hi, Please check the following code .
declare @table table (id int identity(1,1),item varchar(10),amt int)
insert into @table values (1,100),(2,200),(3,300),(4,400)
declare @sumtotal int
select @sumtotal = SUM(amt) from @table
SELECT a.id, a.amt,@sumtotal-SUM(b.amt)
FROM @table...
June 27, 2013 at 1:51 am
Hi
Yes, There is a flaw in the previous logic.:cool:
Here is corrected version
create table #nc (nc1 int,class int,nc2 int)
insert into #nc
values(110,1,112)
,(112,1,110)
,(210,2,212)
,(310,3,313)
...
October 1, 2012 at 5:00 am
Hi
This may help you.
create table #nc (nc1 int,class int,nc2 int)
insert into #nc
values(110,1,112)
,(112,1,110)
,(210,2,212)
,(310,3,313)
,(313,3,310)
,(410,1,141)
,(329,7,231)
select * from #nc
select...
October 1, 2012 at 4:25 am
Hi
I am sending sample procedure to avoid cursors. Implement this logic in your procedures. This may help you.
declare @test_tab TABLE
(
[id1] [int] NULL,
query [varchar](50) NULL,
[result] [bit] NULL)
insert into @test_tab values(1,'select...
July 26, 2012 at 1:47 am
Hi,
Please check the following code. Little bit lengthy procedure.
declare @tbl_expression TABLE
(
[id1] [int] NULL,
[exp1] [varchar](50) NULL,
[result] [bit] NULL)
insert into @tbl_expression values(1,'30 > 50',Null)
insert into @tbl_expression values(2,'70 > 50',Null)
insert into @tbl_expression...
July 26, 2012 at 1:31 am
Hi
Check the following.
declare @yourTable table (Id int identity(1,1),Transdate DATE);
INSERT INTO @yourTable
SELECT Transdate
FROM (VALUES('2012-01-01'),('2012-01-07'),('2012-01-10'),('2012-01-12'),
('2012-01-18'),('2012-01-21'))a(Transdate);
...
March 21, 2012 at 7:34 am
Hi
select convert(bigint,REPLACE ('10,00,000',',',''))
Siva Kumar J
February 23, 2012 at 5:53 am
Hi,
You can try this one.
declare @t table (id int identity(1,1),time_stamp date)
declare @Daysin_Month table (Month_No int, No_of_Days int)
declare @st date,@en date
select @st = '2012-01-01'
select @en = '2012-12-31'
insert into @t
select convert(varchar(10),GETDATE(),110)...
February 21, 2012 at 11:23 pm
Viewing 15 posts - 1 through 15 (of 47 total)