|
SilimSayo wrote: Semantics!!!!
The exact definition is important, and not just a semantical detail. And no, I do not appreciate hit&run comments, as it's a lousy way of communicating.
I are Troll
|
|
|
|
|
Suppose I have a calculated field for age computed from dob and the current date. If this field is not updated and you query someone's age, it will return incorrect results. For example, if the query returns someone's [current] age as 64 when it should have been 65, the result would be incorrect.
|
|
|
|
|
What database are you using? If you are using SQL Server, you can create computed columns. I believe other databases have similar features too. Better yet, create a View with the calculated column.
|
|
|
|
|
You are right, a view (evtl. companyied (is this right ?) with functions) is the right way on the DB side, but that was not the original question - that was about creating additional coloums in the BASE table that hold the calculated results
|
|
|
|
|
HI.
I am currently working on a database application.
I use Sql express studio to model the database and then use LINQ in c# to access it.
Whereas everything is great , the thing is that the database is on the same laptop where there is the application to access it.
Let say this laptop name is "A".
i use the connection string connString = @"server = .\sqlexpress;integrated security = true;database = Whatever";
(YES i am using Winodws authenciation)
But if i want to access database on a different Laptop from the application running on "A", what will be the connection string??
I will connect the Both Laptops through their own WIFI.
|
|
|
|
|
When connecting to remote database you replace the server name. Currently you use dot to tell that the server is local. In case of remote server you would have a connection string like:
server=servername\instancename;integrated security...
Have a look at this site: http://www.connectionstrings.com/sql-server-2005[^]
|
|
|
|
|
I guess i have to use one of the connection string mentioned:-
someting like.
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
I want to know . how to know ip of one computer??
what is network library??
and i am using sql express studio 2008 r2 on both computers.
So where is the keyword /sqlexpress is to be used?
|
|
|
|
|
You don't have to know the IP address, you can use names instead.
\SQLEXPRESS isn't a keyword, it's the name of the SQL Server instance. For example if I have a server called Machine1 and I have two different instances of SQL Server in that server; Production and Test. Now if I want to connect to the Test-instance of SQL Server, I'd use a connection string like:
Data Source=Machine1\Test;...
Perhaps the easiest way to see locally the name of the instance is to open Control Panel and look at services. The instance name is in parenthesis on the service name.
|
|
|
|
|
oh ok..i am getting it..
so my final connection string will look something like this ?
server=computername\instancename ; integrated security = false ; database = "whatever" ; user id = sa ; Password=pass;
|
|
|
|
|
Exactly
|
|
|
|
|
I am trying to do it from a different laptop , which is on the same network...
But it gives error when i try to connect through sql express studio.......
error 26
A network or instance-specific error occured while esablishing a connection to sql server..it might be not found or accesible................is there any other setting i am missing???
and how to make sure that both computers are properly connected over the network?
|
|
|
|
|
|
|
You're welcome Glad it got solved.
|
|
|
|
|
I had asked this question elsewhere and was advised to ask here instead.
I am wondering if anyone knows how internet connection latency and download speed affect query execution time in SQL Server Management Studio. Is that product similar to using a Data Reader instead of a Data Adapter? Is there a flag I can set to make it more like a Data Adapter? I am trying to get better performance on a remote office, especially since Disaster Recovery can be better handled from the headquarters.
I ran a test in SQL Server Management against the same database across the country. One internet connection had 4x the download speed according to speedtest.net, but a larger latency in ms. The difference is that one connection was a slow ethernet connection and the other a faster wireless connection. Same locations, multiple tests with similar results.
Somewhat surprisingly, the connection with the faster download speed took 50% longer to return a recordset in the 5-20 MB range. Is this because querying in SQL Server Management Studio is similar to executing a query with a Data Reader instead of a DataAdapter? If not, what is the issue?
|
|
|
|
|
Hi,
Don't know if SSMS is more like a data reader than a data adapter and I would guess that it depends on how are you using it. For example if you create a query and run it in a query window you'll get results you cannot modify much like with data reader. On the other hand if you open a table for editing then you can modify the results so the functionality is closer to a data adapter.
Concerning the network latency issue, there's one parameter you can define before you connect, that's affecting the speed quite a lot. If you click the options in the connect dialog, you'll find the network packet size which can be modified. If you have a latency issue, I'd guess that you could increase the packet size even to 16'383 bytes which is the maximum (instead of the default 4'096). If you like you can change this default packet size in the instance settings.
|
|
|
|
|
Thanks! I got a 2x to 6x speedup after raising the packet size to 32767. Now the query execution and transportation time is faster with the faster internet connection with slightly higher latency.
|
|
|
|
|
You're welcome, glad it got solved
|
|
|
|
|
Hi,
I have to create one subscription via Vb.net for one simple report .
Once i try to deploy this subsciprion the system returns this message:
"rsInvalidParameter400Value of the parameter 'Parameters' is not valid.http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsInvalidParameter&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=10.0.2531.0Microsoft SQL Server Reporting Services10.0.2531.0127OsIndependent1040ReportingServicesLibraryValues of parameter 'Parameters' is not valid."
Here is the code i wrote for my report.
Dim RS As New ReportingService2005
RS.Credentials = System.Net.CredentialCache.DefaultCredentials
RS.Url = "HTTP://VIROSQL08/REPORTSERVER/REPORTSERVICE2005.ASMX"
Dim report As String = "/MYREPORTS/TEST_REPORT"
Dim desc As String = "TEST SCHEDULE"
Dim eventType As String = "TimedSubscription"
Dim StartDateSchedule As String = Today.ToString("yyyy-MM-dd")
Dim StartClockSchedule As String = "09:27"
Dim scheduleXml As String = String.Format("<ScheduleDefinition><StartDateTime>{0}T{1}:00</StartDateTime></ScheduleDefinition>", StartDateSchedule, StartClockSchedule)
Dim extensionParams(7) As ParameterValue
extensionParams(0) = New ParameterValue()
extensionParams(0).Name = "TO"
extensionParams(0).Value = "CED@MYCOMPANY.COM"
extensionParams(1) = New ParameterValue()
extensionParams(1).Name = "ReplyTo"
extensionParams(1).Value = "reporting@adventure-works.com"
extensionParams(2) = New ParameterValue()
extensionParams(2).Name = "IncludeReport"
extensionParams(2).Value = "True"
extensionParams(3) = New ParameterValue()
extensionParams(3).Name = "RenderFormat"
extensionParams(3).Value = "EXCEL"
extensionParams(4) = New ParameterValue()
extensionParams(4).Name = "Subject"
extensionParams(4).Value = "@ReportName was executed at @ExecutionTime"
extensionParams(5) = New ParameterValue()
extensionParams(5).Name = "Comment"
extensionParams(5).Value = "TEST SCHEDULE"
extensionParams(6) = New ParameterValue()
extensionParams(6).Name = "IncludeLink"
extensionParams(6).Value = "False"
extensionParams(7) = New ParameterValue()
extensionParams(7).Name = "Priority"
extensionParams(7).Value = "NORMAL"
Dim parameter As New ParameterValue()
parameter.Name = "PARAM1"
parameter.Value = "1"
parameter.Label = "PARAM1"
Dim parameters(1) As ParameterValue
parameters(0) = parameter
Dim matchData As String = scheduleXml
Dim extSettings As New ExtensionSettings()
extSettings.ParameterValues = extensionParams
extSettings.Extension = "Report Server Email"
Try
RS.CreateSubscription(report, extSettings, desc, eventType, matchData, parameters)
Catch e As SoapException
Console.WriteLine(e.Detail.InnerXml.ToString())
End Try
If i drop the parameter from my report and then set the Parameters with the value Nothing the deployment works fine!!!
What's wrong?
Thank you
|
|
|
|
|
Harmless joke or a mean prank
|
|
|
|
|
Hi all.
I'm trying to use an XML datatype to pass around tabular data between functions, and I'm a bit unfamiliar with both this and XQuery syntax, so this is troublesome for me.
I have a piece of code like so:
DECLARE @time_series XML;
SET @time_series =
'<timeSeries>
<ts><date>2010-06-30</date><value>1.235648</value></ts>
<ts><date>2010-07-31</date><value>564654.235648</value></ts>
<ts><date>2010-08-31</date><value>5465465.235648</value></ts>
<ts><date>2010-09-30</date><value>952031.235648</value></ts>
</timeSeries>'
;
DECLARE @tbl_time_series TABLE(
ts_date DATETIME
, ts_value FLOAT
);
INSERT INTO @tbl_time_series
SELECT
TS.item.nodes('/date').value('.', 'datetime') AS tsdate
, TS.item.nodes('/value').value('.', 'float') AS tsvalue
FROM
@time_series.nodes('timeSeries/ts') AS TS(item)
;
"item", by my reasoning, should allow me to select the date node underneath it in the select, but it appears not.
I get this message:
Msg 227, Level 15, State 1, Line 19
"nodes" is not a valid function, property, or field.
All I want is to end up with a table like this;
ts_date ts_value
---------- --------------
2010-06-30 1.235648
2010-07-31 564654.235648
2010-08-31 5465465.235648
2010-09-30 952031.235648
when I try this:
INSERT INTO @tbl_time_series
SELECT
TS.item.query('/date').value('.', 'datetime') AS tsdate
, TS.item.query('/value').value('.', 'float') AS tsvalue
FROM
@time_series.nodes('timeSeries/ts') AS TS(item)
;
See the query in the select statement instead of the node? this runs alright, but I get a result set like this:
1900-01-01 00:00:00.000 0
1900-01-01 00:00:00.000 0
1900-01-01 00:00:00.000 0
1900-01-01 00:00:00.000 0
I think I'm nearly there but my XQuery noobiness is failing me...
Any suggestions?
|
|
|
|
|
UPDATE
Solved. Here's the final statement.
DECLARE @time_series XML;
SET @time_series =
'<timeSeries>
<ts><date>2010-06-30</date><value>1.235648</value></ts>
<ts><date>2010-07-31</date><value>564654.235648</value></ts>
<ts><date>2010-08-31</date><value>5465465.235648</value></ts>
<ts><date>2010-09-30</date><value>952031.235648</value></ts>
</timeSeries>'
;
DECLARE @tbl_time_series TABLE(
ts_date DATETIME
, ts_value FLOAT
);
INSERT INTO @tbl_time_series
SELECT
TS.item.query('date').value('.', 'datetime') AS tsdate
, TS.item.query('value').value('.', 'float') AS tsvalue
FROM
@time_series.nodes('timeSeries/ts') AS TS(item)
;
SELECT * FROM @tbl_time_series;
Just as I suspected it was my lack of XQuery-fu... d'oh!
Hope someone else finds this useful anyway.
|
|
|
|
|
I seem to be incapable of figuring out how to construct a query to achieve a simple thing. I was given a Microsoft Access table that looks like this: (This is just a simplified example)
RoadID Begin End
----------------------------
01005 0.0 2.3
01005 2.3 4.2
01005 4.2 10.7
01005 12.5 14.4
01005 14.4 16.9
01002 0.0 13.2
01002 13.2 16.2
01002 16.2 17.8
01002 17.8 21.2
02003 0.0 5.5
02003 7.2 10.2
02003 10.2 16.3
02003 16.3 27.8
Is it possible to make a query to find all the records that have a gap between it and the records before or after it (for each RoadID). The order of the original records should be sorted by RoadID and Begin. For this example, the output should be:
RoadID Begin End
----------------------------
01005 4.2 10.7
01005 12.5 14.4
02003 0.0 5.5
02003 7.2 10.2
In the above result, the first line has 10.7 as the End, and the second line has 12.5 as the Begin -- meaning that there is a gap, so both records should be shown. Same with the third and fourth lines. This is done for each RoadID, so for example, even though there is a gap between these two records (16.9 <> 0.0), they should not be shown in the result because their RoadID values are different (01005 and 01002):
01005 14.4 16.9
01002 0.0 13.2
I have tried to use some inner join tricks but could not get a thing. I could do this through a program, but I am curious to know if a single SQL query could achieve it. Any help on this is appreciated. Thanks!
|
|
|
|
|
How should the query react to overlaps?
|
|
|
|
|
Sorry I failed on making this point. The original question should be to find gaps and overlaps. Good point! Thanks!
|
|
|
|