Hi everyone,
I'm executing simple insert query like below:
INSERT INTO tbl_destination ...
SELECT ... FROM [SomeOtherLinkedServer].tbl_source
It results in 3'000'000 rows inserted to the destination table although the SELECT returns the 9'000'000 rows. What can be the cause?
I'm using SQL Servers 2005 Standard edition. The destination t...
Hi,
We're getting the following error when trying to establish a connection to a database file in the project:
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
Any ideas on how we can fix it?
Thanks in advance!
...
Hi,
I need to extract records from a table, copy the data to a second table and then update the records in the first table to indicate that they have been copied across successfully.
My current SP code is this:
SELECT TBL_ADDRESSBOOKADDRESSES.* FROM TBL_ADDRESSBOOKADDRESSES
INNER JOIN TBL_CAMPAIGNS
ON TBL_ADDRESSBOOKADDRESSES.adds_AB...
i am trying to compare two databases on my SQL Server 2008 using the VSTS Db edition schema compare. I am getting an error "schema comparison not supported for sql 2008".
...
Hi all,
I am using this
SELECT *
FROM sys.dm_exec_query_stats s
CROSS APPLY sys.dm_exec_sql_text( s.sql_handle ) t
ORDER BY
s.max_elapsed_time DESC
to get the longest running queries on the server level.
How do I get the longest running queries per database? I would like to focus only on one database at a time.
Thanks, Edi
...
Hello, I'm building an application that connects to SQL Server 2005. It currently uses Windows authentication, but I'd like to switch to SQL Authentication (I believe it is also sometimes called Mixed Authentication). My current connection string is:
"Data Source=LOCALHOST;Initial Catalog={0};Integrated Security=SSPI"
That's for Windo...
Due to a rather brilliant oversight in my current project, we have some guids getting stored in a varchar column in one table, which need to be compared to a uniqueidentifier column in another.
How can I do this? SQL server simply says it cannot convert from a character string to a uniqueidentifier.
...
Is there a way to dynamically determine (from .NET code or TSQL) the columns a stored procedure will return? I would like to dynamically generate wrapper functions in .NET for my stored procedures. It is easy to get proc names/parameters/etc. but I would also like to know what columns to expect when a procedure returns data (without exec...
I have to update value based on values from another table:
update OracleOb..NS.myTable set name = (select name from myTable1 where id = 1)
where id = 1
here the SQL has some problem. How can I get value from myTable1 and set it to myTable?
I am using MS SQL 2005.
Sorry I have to edit this question again. The table myTable is a li...
update: changed one time to show that the times per shipment may not be in sequential order always.
here is my input
create table test
(
shipment_id int,
stop_seq tinyint,
time datetime
)
insert into test values (1,1,'2009-8-10 8:00:00')
insert into test values (1,2,'2009-8-10 9:00:00')
insert into test values (1,3,'2009-8-10 10:00...
Hey guys,
Apologies in advance since I feel like I'm probably forgetting/missing something obvious on this one. Here goes; I'm using a case statement in my WHERE clause, the below works fine:
WHERE r.[SomeCol] = @SomeColVal
AND SomeOtherCol =
(
CASE WHEN (@Year = 0 AND @Period = 0) THEN
@SomeVal
CASE WHEN...
...
CASE ELSE
@SomeVal
EN...
SQL reporting services has a little search box in the top of the report viewer. When used, it finds the search text, navigates to containing page and highlights the text on the page. My question is how can I do this when the report loads.
Currently I have a reportviewer embedded in my page. Is there a method that will find? I am usi...
Think that says it all?
...
This seems like an easy thing, but I'm drawing a blank.
Select * from
....
inner join
(
select JobsID, Value from Jobs where Value **is the highest**
) as MaxJob on MaxJob.CustID = A.CustID
inner join
(
select other information based upon MaxJob.JobID
) as OtherStuff
Is there a nice way to have that first subquery gi...
Columns such as CreatedDate and ModifiedDate are commonly used in the SQL tables. I think, storing the UTC value of the time would help remove dependency on the location of the server hosting the app. With the cloud computing gaining familiarity(even excluding it), the applications could be hosted in any timezone and in any part of the w...
Hi.I'm building a web site that's showcasing a large amount of products.
I want the URL to be human-friendly and optimized for search engines, so I want the filtering of products to be reflected in the URL.
For example, a possible URL path for filtering the products would be
website.com/Type/Car/Country/Usa/Manufacturer/Ford/Year/2007
...
I have a smalldatetime column that I need to alter to be a datetime column. This is something that will be part of an install process, so it cannot be a manual procedure. Unfortunately, the column has a few indexes and a not null constraint on it. The indexes are performance related and would need to be retained only using the new data t...
The objective is below the list of tables.
Tables:
Table: Job
JobID
CustomerID
Value
Year
Table: Customer
CustomerID
CustName
Table: Invoice
SaleAmount
CustomerID
The Objective
Part 1: (easy) I need to select all invoice records and sort by Customer (To place nice w/ Crystal Reports)
Select * from Invoice as A inner join...
SELECT * FROM
(SELECT BAR.DIAGNOSES FROM FOO INNER JOIN BAR ON FOO.AN = BAR.AN WHERE FOO.ADMWARD IN (16,17) AND (BAR.DIAGNOSES IS NOT NULL)
UNION ALL
SELECT BAR.UNDERLYINGCAUSE FROM FOO INNER JOIN BAR ON FOO.AN = BAR.AN WHERE FOO.ADMWARD IN (16,17) AND (BAR.UNDERLYINGCAUSE IS NOT NULL)
UNION ALL
SELECT BAR.UNDERLYINGCAUSE2 FROM FOO INNE...
Hi all,
I need to improve some existing stored procedures in my project for better transaction handling. I understand I can use the SET XACT_Abort ON statement in my procedure so that transaction will be automatically rolled back in case of errors. I can also use Try/Catch block for error handling and roll back the transaction in the Cat...