In a scripting step in a scheduled task in SQL Server Agent 2005, I need to trigger a webscript that is running on a different server. I'm doing this:
Dim ie
Set ie = CreateObject( "InternetExplorer.Application" )
ie.navigate "...to my dreamscript"
' Wait till IE is ready
Do While ie.Busy
(1)
Loop
ie.Quit
set ie = Nothing
At (...
Which is more efficient?
SELECT theField
FROM theTable
GROUP BY theField
or
SELECT DISTINCT theField
FROM theTable
...
I see that in the SQL Server Reporting Services 2005 Report Manager there is the capability to schedule reports for specific times (i.e. every weekday at a particular time).
What I would like though is more control -- i.e. every weekday, but only between certain dates of the year -- for example, getting sales figures every day starti...
I am trying to use the actual numerical value for the month on a sql query to pull results. Is there any way to do this without having a function to change the numbers to actual month names, then back to month numbers? The following code works for Names, what works for numbers?
datename(month,(convert(datetime,DTSTAMP)))=
'Octobe...
If I have the following nvarchar variable - BTA200, how can I extract just the BTA from it?
Also, if I have varying lengths such as BTA50, BTA030, how can I extract just the numeric part?
...
I'm executing the following query:
Select guiPolygonID, dbo.fn_Yval(p1X, p1Y, p2X, p2Y, 4.003318)
From [vPolygonSegments]
Where dbo.fn_Yval(p1X, p1Y, p2X, p2Y, 4.003318) > 0
The important parts of function fn_Yval (all params are of type float):
set @m = (@p2Y - @p1Y)/(@p2X - @p1X)
set @b = @p1Y - (@m*@p1X)
set @result = (@m*@xval+@b...
I have two fields in a table. One contains values such as BTA, BEA, REA. The other contains values such as 1,2,63,103.
I want to combine the 2 fields so they look like this BTA001, BTA002, BTA063, BTA103.
Notice how if the numbers are not 3 characters in length, I want to pad some 0's to the left of the number to make it equal to 3.
...
I have an excel spreadsheet that I want to import select columns into my database table. the wiz didn't offer that option.
any easy code options?
Thanks
newbie
...
If I wrap a SQLConnection in a Using, should I close it or does the end using handle it?
using cn as new system.data.sqlclient.sqlconnection()
cn.open
'{do a bunch of other stuff with commands and datareaders here}
cn.close 'Do I need this?
end using
...
Hello
I have an application (ASP.NET 3.5) that allows users to rerun a particular process if required. The process inserts records into an MS SQL table. I have the insert in a Try / Catch and ignore the catch if a record already exists (the error in the Title would be valid). This worked perfectly using ADO but after I conveted to LINQ I...
Although this question looks simple, it is kind o tricky.
I have a table with the following columns:
table A:
int ID
float value
datetime date
varchar(50) group
I would like to obtain the "ID" and "value" of the records that contains the maximum "date" grouped by the column "group". Something like "what is the newest value fo...
Does anyone know the powershell commands to restore a remote database from a local file?
...
Hi,
I'm calling the code below.
On the line (IDataReader dr = cmd.ExecuteReader()) sql barfs with an Incorrect syntax near 'CompanyUpdate'.
using (SqlCommand cmd = new SqlCommand("CompanyUpdate"))
{
cmd.Parameters.Add("@CompanyID",SqlDbType.Int);
cmd.Parameters.Add("@Description",SqlDbType.VarChar,50...
Hi, I am a beginner at SQL Server and I have a question about how best to do this.
I have a table that looks like this:
ID Parent Level
1 NULL 0
2 1 1
3 1 1
4 2 2
5 2 2
6 3 2
7 2 2
8 5 4
9 4 3
10 ...
Does anyone know the query the last synchronization date from sql server (2008).
It is the same information displayed in replication monitor, but I want to be able to get that date from a query.
...
I need a simple SQL to accomplish the below:
Problem:
When a petrol bunk runs out of fuel, the admin makes note of the DateTime (RunOutDate) when it ran out of fuel and notes also the DateTime (ResupplyDate) when the fuel supply was back on.
I need to create a report on how many days the bunk ran out of fuel.
eg.
1/1/1 10:10 to 1/1/...
Hi I'm very new to sql but have been passed a job in which I need to query the db(MS SQL 2005) I need to return all workers where a HeadID is given.(tables below)
So I need to get all the managers that match the HeadID and then all the workers that match those managers by ManagerID. How would I do this? Any help or any sql terminology th...
Hi, Using the code below, I am returning an nvarchar field from ms sql 05 and keep getting a System.InvalidCastException.
vo.PlacementID = dr.IsDBNull(0) ? null : dr.GetString(0);
The vo.PlacementID variable is of type String so there shouldn't be a problem.
The values I am trying to return are like this (number, number, letter): 00F,...
Any tools as useful as these?
...
I have had a few problems with log files growing too big on my SQL Servers (2000). Microsoft doesn't recommend using auto shrink for log files, but since it is a feature it must be useful in some scenarios. Does anyone know when is proper to use the auto shrink property?
...