hi all,
i am using SQL server express 2005 as an backend. I created a backup file programmatically.If i use same server , then it restore the data successfuly. however if we try to restore on different server, then it fails. and throw following message
"The Backup set Holds a backup of a database other than the existing 'DatabaseName' d...
Getting unique rows/values in SQL. I have same some data like this
valueA ValueB ValueC
test "Value1" "Something"
test "Value1" "Something else"
test2 "Value1" "Something else"
So then I want to get the first two rows since valueC is different and then I also want row
3.
but say Row 4 is
test "Value1" "Somethin...
Hi, I have a requirement to calculate the Moving Range of a load of data (at least I think this is what it is called) in SQL Server. This would be easy if I could use arrays, but I understand this is not possible for MS SQL, so wonder if anyone had a suggestion.
To give you an idea of what I need:
Lets say I have the following in a sql...
I have this query:
SELECT COUNT (DISTINCT CUSTOMER_ACCOUNT.ID) AS NUMBER_OF_ACCOUNTS
FROM CUSTOMER_ACCOUNT
INNER JOIN ACCOUNT ON CUSTOMER_ACCOUNT.ACCOUNT_ID=ACCOUNT.ID
INNER JOIN CUSTOMER_ACCOUNT ON LOAD_ACCOUNT_DETAIL_0.ID = CUSTOMER_ACCOUNT.ID
WHERE Convert(datetime, convert(char(10), [CUSTOMER_ACCOUNT].CREATED_ON, 101)) BETWEEN ...
I have this query in SQL Server 2005:
SELECT J.JobID,
dbo.tblCustomers.Name AS CustomerName,
J.CustomerJobNumber,
J.JobName,
(CASE WHEN [tblCustomers].[CoreCust] = 0 THEN 'AUXILIARY' ELSE 'CORE' END) AS Department,
J.JobStatusID,
dbo.tblJobTypes.JobType
FROM dbo.tblJobs (NOLOCK) AS J
IN...
Hi, I created the following encapsulation over the SQL Dependency object:
public class DependencyTracker
{
private SqlDependency _SQLDependency = null;
public string ConnectionString
{ get; private set; }
public string CommandNotifier
{ get; private set; }
public delegate void Refre...
How to store the value of the PolicyID returned from database in an integer variable in C#?
I am using SQL server 2005.
System.Data.SqlClient.SqlConnection dataConnection = new SqlConnection();
dataConnection.ConnectionString =
@"Data Source=JAGMIT-PC\SQLEXPRESS;Initial Catalog=SumooHAgentDB;Integrated Secur...
In the never-ending search for performance (and my own bludgeoning experience), I've learnt a few things that could drag down the performance of a SQL statement.
Obsessive Compulsive Subqueries Disorder
Doing crazy type conversions (and nest those into oblivion)
Group By on aggregate functions of said crazy type conversions
Where fldID ...
I have a tables like the following
CREATE TABLE Company
(
Id INT
)
CREATE TABLE CompanyNumbers
(
CompanyId INT,
NumberText VARCHAR (255)
)
What I want as an output is this in pseudo code
Give me all the numbers for company A as a single comma separated string, if the string contains more than 150 numbers output another row with next...
In SQL Server is there a way to have an output parameter return the total number of records (for paging) in a parameterized query?
...
Hi,
I'm connecting to SQL Server using the Zend_Db_Adapter_Sqlsrv via SQL Server driver for PHP
Wondering how I can insert a date which is read in from a web form in format dd/mm/yyyy into a datetime column
Thanks in advance
...
I have a long query that I'd like to replace the , with a carriage return to put all the fields on their own line but I can't figure out how to do it in the editor. It wont be fool proof, but better than doing it by hand.
...
I am working on some software that has to create dummy entries in various databases (Oracle, DB2, SQLServer) temporarily. Every column in the the row is filled with random data.
The code uses java.sql.DataBaseMetaData class in java to get the COLUMN_SIZE attribute to figure out how large of a random string to store in the VARCHAR2 and ...
OK, here is goes. I’m not a database guru or admin. In fact, besides some occasional index / query tuning, I don’t poke around too often in databases. One of the things which often eludes me is the SQL Server transaction log. I know what it’s for, what it contains and how it works (at least conceptually), but I think I don’t get why SQL ...
Hello all,
We have our current system using PHP and Microsoft SQL Server.
I am trying to work out if there will be a performance gain in using PHP and MySQL?
It will require some effort to change to this platform so I am hoping to find out as much as I can. Are there any questions I should be asking myself to determine the correct cho...
I need to implement a service to search PDFs. Initially I started using SQL Server 2008 FTS, but soon realized that my PDFs would have to be stored in the DB itself. I was then pointed to Indexing Services as well as to the SQL 2008 FILESTREAM data type so that I can store PDFs in the file system. So how do these three (Indexing Servi...
I'm just doing some stat collection on multiple servers, and as a test I'm working with my machine (Machine A) and another machine (Machine B) on the local network.
My Machine (A) is collecting all the information in the staging table from the other Machine (B). I have a sp that runs and dynamically creates something like this:
exec (...
I need to calculate all Employees that have X number of consecutive absences within a date range in SQL.
We have an Absences Table with 1 record for each day an employee is absent and a Calendar Table with the work days for the year.
tblAbsences
EmployeeID int
AbsenceDate datetime
tblCalendar
WorkDay datetime
Does anyone have any ...
I have data formatted "2009-07-17T00:00:00-05:00" in varchar variable. How can I convert this data to datetime field in MS SQL server using query or TSQL?
...
I have a TSQL Query that does something like this:
SELECT SUM(s.Amount) as TotalSales, p.ProductName
FROM SALES s
INNER JOIN Product p ON s.ProductID = p.ID
GROUP BY p.ProductName
The resulting output is
TotalSales Product
-----------------------
123.45 Apples
234.56 Oranges
345.67 Grapes
What I would like to do is...