Viewing 5 posts - 1 through 5 (of 5 total)
alter procedure update_use
(
@name varchar(20),
@class nvarchar(30)
)
as
begin
declare @id int
select @id=id from grts where name=@name
if exists (select * from grts where id=@id)
begin
update grts set name=@name,class=@class where id=@id
end
else
begin
insert into grts (name,class) values(@name,@class)
end
end
June 4, 2013 at 3:57 am
create table varchartest(a varchar(30),b varchar(30))
create table varchartest_1(a varchar(30),b int)
insert into varchartest values ('xyz','1')
,('abc','2')
,('bcd','3')
,('efg','4')
,('erer','5')
--,('rerer','x')
,('rerer','7')
alter table varchartest_1 add c int identity
insert into varchartest_1(a,b) select a,b from varchartest
select * from...
June 4, 2013 at 2:08 am
With MySampleData([Business Unit],[Description 01])
AS
(
SELECT 'MFMGOOGLE','ertCOST POOLert' UNION ALL
SELECT 'MFMArnoldDeCaprio','COST ert' UNION ALL
SELECT 'MFMBruceSchwarzenegger','ewtrCOSTwerwer POOL' UNION ALL
SELECT 'MFMArnoldDamon','COSTerwer ' UNION ALL
SELECT 'MFMLeonardoPitt','sdfsf' UNION ALL
SELECT 'MFMBruceWahlberg','fffffCOST_POOL'
)
SELECT
CASE WHEN [Description 01]like '%COST POOL%'...
June 3, 2013 at 2:58 am
Hi,
For getting the substring except MFM from the SQL Server DB itself,
With MySampleData([Business Unit])
AS
(
SELECT 'MFMGOOGLE' UNION ALL
SELECT 'MFMArnoldDeCaprio' UNION ALL
SELECT 'MFMBruceSchwarzenegger' UNION ALL
SELECT 'MFMArnoldDamon' UNION ALL
SELECT 'MFMLeonardoPitt' UNION ALL
SELECT...
June 3, 2013 at 2:46 am
In SQL Server 2005, it won't give the answer other the syntax error since we have to use
'insert into table ' with 'union all' statement for the insertion to...
July 20, 2011 at 2:41 am
Viewing 5 posts - 1 through 5 (of 5 total)