Viewing 15 posts - 16 through 30 (of 47 total)
begin
declare @param varchar(10),@dateFrom varchar(10)='09/13/2011'
declare @output nvarchar(255),@output1 nvarchar(255)
declare @tab_cnt int,@init int= 1,@query nvarchar(500)
declare @input_filename table (sno int identity (1,1),table_name varchar(20))
declare @output_tab table (sno int identity(1,1),table_name varchar(20),cnt int)
set @output = N'@outputval nvarchar(255)...
February 6, 2012 at 5:58 am
Hi
I am using basic emp table.
select * from EMP a where exists(
select mgr from EMP b where a.MGR= b.mgr group by mgr having count(*)>2)
order by mgr
Regards
Siva Kumar...
January 31, 2012 at 1:23 am
Hi
You can try this.
declare @tab table (prodid int,amt int,qty int,salesdate date)
insert into @tab values (1,1000,10,'2011-11-01'),
(2,1500,15,'2011-12-01'),
...
January 19, 2012 at 4:25 am
Hi
This is the other way.
Select 'Select'
union all
Select 'from'
union all
select 'where'
union all
select 'group by'
Regards
Siva Kumar J.
January 19, 2012 at 4:14 am
Hi,
select 'sp_depends '+''''+table_schema+'.'+table_name+'''' from information_schema.tables
regards
Siva Kumar J.
June 23, 2011 at 6:16 am
Hi
Following is another way to get rid of duplicate data
DECLARE @tmpTable table(
[id] [varchar] (30),
[firstname] [varchar] (30),
[lastname] [varchar] (30),
[company] [varchar] (100)
)
INSERT @tmpTable SELECT '902','suresh','bangalore','sm soft'
INSERT @tmpTable SELECT '905','ramesh','xyz','company llc'
INSERT @tmpTable SELECT...
June 13, 2011 at 5:35 am
Hi
-- for dataset 1
select * from #Cartesis_to_hfm a where exists(
select CartesisRU,CartesisBU,COUNT(*) from #Cartesis_to_hfm b
where a.CartesisBU = b.CartesisBU and a.CartesisRU = b.CartesisRU
group by CartesisRU,CartesisBU having COUNT(*)>1)
-- for dataset 2
select *...
June 10, 2011 at 3:47 am
Hi
Following my help for you.
----- code ------
declare
@baslik varchar(max),@resim varchar(max),@tablo varchar(50),
@sira varchar(10),
@id varchar(10)
set @tablo = 'emp'
declare @sqlcum nvarchar(max)
set @sqlcum ='update '+@tablo
+' set baslik = '+isnull(@baslik,'''''')+','
+' resim = '+isnull(@resim,'''''')+','
+' sirano = '+isnull(@sira,'''''')+
'...
June 6, 2011 at 3:02 am
Hi
Go to SSMS
select the required db from databases
rightclick->Tasks->Generate Scripts
set true/false for required options
then select required tables/functions/procedures
save the results to a script to file/script to query window/script to clipboard.
Then copy the...
June 5, 2011 at 9:49 am
Hi
Generate the script file using Generate scripts option. Then execute that sql file in required areas.
Regards
Siva Kumar J
June 2, 2011 at 12:53 am
Hi
You can use MERGE statement, in sql 2008R2. This may be helpful.
http://technet.microsoft.com/en-us/library/bb510625.aspx
Regards
Siva Kumar J.
June 1, 2011 at 12:10 am
check this....
-----------------
DECLARE @TableName varchar(max)
DECLARE getTableName CURSOR FOR
select ss.name + '.' + o.name as table_name
from sys.objects o
join sys.schemas ss on ss.schema_id = o.schema_id
where type = 'u' and
ss.name + '.' +...
May 30, 2011 at 3:38 am
Hi,
Modified the given query. Now its running perfectly.
declare
@organization varchar(16),
@data_view varchar(16),
@subgroup varchar(16),
@i int
set @i=0
DECLARE org_cursor CURSOR FOR
select organization, data_view, subgroup from test
open org_cursor
fetch next from org_cursor
into @organization, @data_view,...
May 24, 2011 at 7:10 am
I given you the solution how to extract data from text file to Sql server Table. This code is purely Sql Server.:w00t:
Siva
March 3, 2011 at 6:22 am
Hi
It is very easy to load data from text,csv etc to oracle tables using External Table concept.
You load external data (.txt,.csv etc) into sql table in following way.
step1:
IF EXISTS...
March 3, 2011 at 5:54 am
Viewing 15 posts - 16 through 30 (of 47 total)