Friday, March 30, 2012
Openquery with a sub-sql referening sqlserver table.
I need to do a openquery to a linked server, and get record with id no in a sub select pointing to a table stored in SQLServer.
I have something like this:
select * into tmptable
from openquery (select * from linkedserverTable where id not in (select distinct(id) from sqlserverTable))
How to make sqserverTable not pointing to linked server, but sqlserver ?
Rgds
JCselect *
into tmptable
from openquery (linkedserver,'select * from linkedserverTable')
where id not in (select distinct id from sqlserverTable)
Wednesday, March 28, 2012
Opening SQL Server Emterprise Maneger takes long time
or expanding other sub level it takes about 1-3 min.
Anyone that has an ide why? (When making select in
databases this takes normal long time)Make sure that the autoclose database option isn't set for the databases, and that you don't have ODBC tracing turned
on.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Fredrik" <fredrik.ehrenholm@.proserva.com> wrote in message news:05fd01c36569$61b4b4b0$a501280a@.phx.gbl...
> Connectin to server goes quik but when listing databases
> or expanding other sub level it takes about 1-3 min.
> Anyone that has an ide why? (When making select in
> databases this takes normal long time)sql
Monday, March 26, 2012
Opening And Closing DB in different Sub Routiens
Thanks,
Greg
Hello greg,
> open the my Sqlconnection in the Page_Load subroutien...
> and then close that SqlConnection in the Page_Unload routine.
the trick is declaring a private member to keep reference to the connection object. Here is some sample code:
Private Conn As SqlConnection
Protected Sub Page_Load(...)
Conn = DAL.StartConnection()
End Sub
Protected Sub Page_Unload(...)
DAL.StopConnection(Conn)
End Sub
Protected Sub Submit_Click(...)
DAL.PerformSubmit(Conn, ...)
End Sub
Btw, this is not quite recommended practice, as you may guess... ;)
In any case, HTH. -LV
There really is very little overhead involved with opening and closing an SqlConnection. The Connections are usually pooled, and opening and closing the connection is extremely quick. That being said, if you want to implement it, and you won't need 2 connections open at the same time, then I would implement something like:
Private Conn as SqlConnection
Private Sub DoOpen
If Conn IS NOTHING then conn=new sqlconnection({Your connect string})
if Conn.state=closed then conn.open
end sub
Protected Sub page_Unload
If Conn.state<>closed then conn.close
end sub
Then whenever you would normally open your connection, issue a call to DoOpen. That way if you don't actually need to open the connection anywhere on your page, you won't bother doing so.
|||> So Then would it be better practice to just open, and close the database connection every time i make a database call. even if it might happen multiple times, and in multiple subroutiens on any given page?
That's common practice and works quite well in common scenarios. After all, keeping a connection open involves its own overhead, so its rather a question of balance.
Indeed, what counts more is: are you sure you need all those queries and you couldn't do the same into a single or few stored procedures? (I'm not claiming you have too many queries; this just is general advice.)
-LV
Wednesday, March 21, 2012
Open the subreport in an new window .
thanks for the reply .i have tried this but it is not opening in an new window ,
this is what i have written
http://localhost/ReportServer?%2fCapacityReport%2fSub1&rs:Command=Render&rc:LinkTarget=_blank&WORKCENTER=PAINT%20&STARTDATE=8/18/2005&DAILY_WEEKLY_MONTHLY=DAILY&rs%3aParameterLanguage=&rc%3aParameters=Collapsed.
can you give me an example