I wonder how can i read a xml data and transform it to a table in TSQL?
For example:
<row>
<IdInvernadero>8</IdInvernadero>
<IdProducto>3</IdProducto>
<IdCaracteristica1>8</IdCaracteristica1>
<IdCaracteristica2>8</IdCaracteristica2>
<Cantidad>25</Cantidad>
<Folio>4568457</Folio>
</row>
<row>
<IdInvernadero>3...
I want to number the rows in my result set. I want some way I can have a result set of 3 records use some SQL keyword to generate a column that would read 1,2,3 for watch of the records...
I know I can make a temp table with an auto increment column but i wanted to know if there was a way I can get this back from a SQL query?
SELECT r...
Right now I have a DB where the PK's are int IDENTITY. I recently, in the last year, was tasked with adding these to a Replication Topology. This has worked out quite well with the exception of the IDENTITY fields.
I want to explore my options for changing or replacing them with a uniqeidentifier(GUID).
Is it feasible to insert a NEW ...
I have a stored proc defines as follows.
PROCEDURE [dbo].[GetSales](@dateFilter nvarchar(50))
AS
BEGIN
SELECT sum(Amount)
FROM Sales
WHERE SalesDate in (' + @dateFilter + ')
group by SalesDate
END
to select data from this table
Id SalesDate Amount
1 Apr-2010 40.25
2 May-2010 12.10
3 Jun-2...
Would like to know is there a way to script to transfer securables accorss database.
...
I have setup Database mirroring for SQL Server 2005 for my database on two different SQL Server machines. There is no witness server used here. I also see the status "Principal/Synchronized" and "Mirror,Synchronized/Restoring" respectively on Primary and Mirror servers for my database.
Now I wanted to test whether the failover to mirror...
I'm a novice at regexs and am currently trying to come up with a simple regex that searches for a serial number in the following format: 0217103200XX, where "XX" can each be a numeric digit. I'm using SQL Server Management Studio to pass the regex as a parameter in a stored procedure. I'm not sure if the syntax is any different from ot...
Is there a way to search for text within stored procedures? For example I want to find out if a particular table is being referenced by any stored procedure.
...
Here's a table with a computed column in SQL Server 2005:
CREATE TABLE footable AS
[identifier] nvarchar(255) NOT NULL,
[result] AS CASE
WHEN [identifier] like '%\[%]' escape '\'
THEN LEFT( [identifier], CHARINDEX('[',[identifier]) - 1 )
END
Here's what I'm expecting:
identifier result
======================...
I have a huge table with the following format:
DATETIME NUMBER
--------------------------------------
2009-03-31 16:05:52.000 2453651622
2009-03-31 16:16:12.000 30206080
2009-03-31 16:16:16.000 16890039
2009-03-31 16:16:28.000 2452039696
2009-03-31 16:16:33.000 140851934
2009-03-31 16:16:51.000 245312...
I have data as follow
DECLARE @tmp TABLE(cid int, colspan int, rowspan int, corder int)
INSERT INTO @tmp
SELECT 1,2,null,1
UNION
SELECT 2,null,null,2
UNION
SELECT 3,null,null,3
UNION
SELECT 4,3,null,4
UNION
SELECT 5,null,null,5
UNION
SELECT 6,null,null,6
UNION
SELECT 7,null,null,7
I want to query to return
cid colspan rowspan cor...
i have a table which contains the following fields
Supervisorid
Empid
This is just like a referral program. A guy can refer 3 guys under him i.e,
3 is referring three guys namely 4 5 8 similarly 4 is referring 9 10 and 11 likewise 8 is referring 12, 13 it goes like this..
I want a query to get the total no of down line members under...
EXACT duplicate of Sql Server2005 query problem
i have a table which contains the following fields
•Supervisorid
•Empid
This is just like a referral program. A guy can refer 3 guys under him i.e, 3 is referring three guys namely 4 5 8 similarly 4 is referring 9 10 and 11 likewise 8 is referring 12, 13 it goes like this..
I want a ...
Hi friends ,
I have done a web project ( using C# + SQL CE + ASP.NET )where it does few manupulation with .sdf file and results are displaye via ASP.net page . While i started working I hardcoded the path of the connection string and worked in my system . Now I want this database to be residing inside my server page.
How do i get t...
I'm writing a program in c# to export SQL Server data from one database and importing it in another. Since these two servers are not connected I need to choose a method such as bcp.
What are the differences between these two? Is one more efficient than the other? And in what scenarios?
What are the known limitations/compatibility issu...
I am doing some tests using the SQL 2005 profiler.
I have a stored procedure which simply runs one SQL query.
When I run the stored procedure, it takes a long time and performs 800,000 disk reads.
When I run the same query separate to the stored procedure, it does 14,000 disk reads.
I found that if I run the same query with OPTION(re...
i have a table which contains the following fields
Supervisorid
Empid
This is just like a referral program. A guy can refer 3 guys under him i.e, 3 is referring three guys namely 4 5 8 similarly 4 is referring 9 10 and 11 likewise 8 is referring 12, 13 it goes like this..
I want a query to get all EmpId under a guy say 3
Below is ...
I need to group by ,even if is there a difference in values for a column by converting to a text value and needs that text value to be included in select list
How is this possibe?
SELECT col1,col2
FROM
(
SELECT col1,col2 FROM table1
UNION ALL
SELECT col1,col2 FROM table2
UNION ALL
SE...
I have two tables Table1(FileID,BundledFileID,Domain) and Table2(FileID,FileType,FileName).
In Table2 FileID and FileType are the composite primary key. I want to create a foreign key relationship from Table1.FileID to Table2. Is it possible to do this? Then how plz help.
I am using SQL Server 2005
...
Hello
I've just installed SQL Server 2005 Express and I'm trying to login to Management Studio but I don't know what the "Server Name" is to be able to login.
I've tried:
localhost\SQLEXPRESS
127.0.0.1\SQLEXPRESS
SQLEXPRESS
<computer name>\SQLEXPRESS
<username>\SQLEXPRESS
The authentication mode is Windows Authentication.
The error...