Thanks for your response. But I am not getting your idea
Can you try with this data
declare @tbl1 table
(id int,
pname varchar(100)
)
declare @tbl2 table
(id1 int,
id int,
fname varchar(100)
)
insert into @tbl1 (id, pname)
select 1, 'aa'
union all
select 2, 'bb'
union all
select 3, 'cc'...
Here is a data
declare @tbl1 table
(id int,
pname varchar(100)
)
declare @tbl2 table
(id1 int,
id int,
fname varchar(100)
)
insert into @tbl1 (id, pname)
select 1, 'aa'
union all
select 2, 'bb'
union all
select 3, 'cc'
insert into @tbl2 (id1, id, fname)
select 1, 1, 'dd'
union all
select...
I have tables say tbl1, tbl2, tbl3
I am joing this table to get back some recordsets
select a.col1
b.col2
c.col3
from tbl1 a inner join tbl2 b
on a.col1 = b.col2
inner join tbl3 c
on b.col1 = c.col2
the resultset will teturn
col1 col2 col3
1370 1446 aa...
I should keep all them though.
The problem is with the NULL, if one field is Null,
I think I can't equate the Null field
I used 'SET ANSI_NULLS OFF' in my code, it is not helping out
any suggestion how to equate two null fields?
Thanks
please discard the above post
below is the correct one
I have two tables, @tmpTable4 and @ReportTable,
I wrote this script to update the last two fields of table @tmpTable4 i.e. ISDEL and REMARK with the last two fields of @ReportTable
but it is not updating what will be the reason
here is...
I have two tables, @tmpTable4 and @ReportTable,
I wrote this script to update the last two fields of table @tmpTable4 i.e. ISDEL and REMARK with the last two fields of @ReportTable
but it is not updating what will be the reason
here is the script
SET ANSI_NULLS OFF
GO
DECLARE @ReportTable...
I wrote a query which can be run on different servers
I want to pass the server name and database name as a parameter to my query.
how can I do that
can I do
select * from @servername.@databasename.dbo.tbl
Thanks
you mean
update svr1.db1.dbo.tmp
set col1 = 'a'?
I tried this and generated this error
[OLE/DB provider returned message: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB'...
I want to update a table tbl on serer svr1 and database db1
update tmp
set tmp.col = case when tmp.col1 = 1 then tmp.col1 + 1
else tmp.col1 + 2
end
from OPENROWSET('SQLOLEDB','svr1';'uid';'pwd','select * from db1.dbo.tbl') tmp
but it is erroring
the...
I have created a linked list, but it still fails to update
here is the error
[OLE/DB provider returned message: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB'...
I have a table called tbl on server svr1, database db1, owner is dbo
I want to update it from server svr2, database db2
I wrote a query
update svr1.db1.dbo.tbl
set col1 = case when col1 = 1 then 1.0
else 2.0
end
where col2 = 'aa'
but it is complaining
what should...
I am trying to get the max employee change number
for some reason when an employee doesn't have change number i.e when it is null, my query doesn't pick that specific record. below is the query I wrote
what is the problem with my query
create table #tmp (ID int, EMP_ID int, EMP_VER_NUMBER...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.