Hi, Can we use XACT_ABORT ON to execute DDL statements, to revert changes in metadata if error occurs? Is there any constraint like that type of statements does not get reverted or mermory issues encounters etc? Moreover if we can do so may i have some code sample for the same? Thanks in advance...
-- Lalit
...
I have a table with the following columns:
agent status
A Mail Sent
B Fax Sent
A Fax Sent
B Mail Sent
B Mail Sent
B Fax Sent
I want to get this result:
Agent Fax_Count Mail_Count
A 1 1
B 2 2
...
so I created that(I used some stuff found on other website) to handle transactions and having a sort of stacktrace while executing stored procedure that could call other stored procedure that need transaction and etc.
so if I have A calling B and B is calling C and C got an error, I can correctly rollback my stuff and returning a stackt...
Something like:
SELECT * FROM sys.functions
...
How to remove primary key constraint from column.
I have table t_data_dnefrc table. In that i have AccountNbr column which is primary key. I want to remove Primary key constraint for that column.
...
Hi All,
i've a query that is supposed to return the sum for "status"-duration entries. The duration is calculated by using datediff(n, datestamp, (subquery that returns the datestamp ending the current status, i.e. finds the next fitting "status change"-entry after the one locked at)
My Problem is that the following query returns an mu...
Hi,
I need to create a stored procedure which will get destination IP and then call tracert or ping and then write the result into a sql table so then I can show user the result in a web page .
is it possible to do this ? if yes would you please tell me how because I have searched a lot and didn't find a proper solution .
and if not wha...
I have huge query on my SQL 2005 Server. This have to be run once everyday but when this query runs temp db grows from 2GB to 48GB. What is the best way top optimize or find the reason why tempdb is growing when this query adds/updates on 80K records with (~120 columns) on a single table?
What should I do on this query that tempdb would...
I have a table with the following data:
Fiscal Year | Fiscal Quarter | Fiscal Week | Data
2009 | 2 | 22 | 9.5
2009 | 2 | 24 | 8.8
2009 | 2 | 26 | 8.8
2009 | 3 | 28 | 8.8
2009 | 3 | 31 | 9.1
2...
what would be the simplest way to change every nvarchar column in a database to a varchar?
I personally would prefer nvarchar, but the data arch has specified that varchar must be used.
...
The development group I'm currently in uses Visual Source Safe for our version control; this choice was originally made due to cost and it's tight integration with Visual Studio.
As our repository has grown Source Safe is really starting to show it's limitations and we are considering moving to another solution. Up for discussion prima...
I am using SQL Server 2005 and trying to write a query where I want to retrieve payments for a given month. I currently have:
select sum(p1.paymentamount) as subtotal,
CONVERT(char(10), p1.paymentdate, 103) as paymentdate
from tblpayment p1
where 1=1
and p1.paymentdate >= @fromdate
and p1.paymentdate <= @todate
group by...
Assume a table with the fields TransactionId, ItemId, Code, EffectiveDate, and CreateDate.
+---------------+--------+------+------------------+------------------+
| TransactionId | ItemId | Code | EffectiveDate | CreateDate |
+---------------+--------+------+------------------+------------------+
| 1| 1| ...
After having checked extensively for an answer to this question, I still cannot find a satisfying solution. So here goes.
I need to store possibly large amount of data in a column of an SQL Server 2005 table. I absolutely need to work in a streaming fashion, so that :
When writing, the data is sent in chunks to the database. Is there ...
Example:
USE AnotherDB
-- This works - same ID as from other DB
SELECT OBJECT_ID('AnotherDB.ASchema.ATable')
-- This works
SELECT OBJECT_NAME(OBJECT_ID('AnotherDB.ASchema.ATable'))
USE ThisDB
-- This works - same ID as from other DB
SELECT OBJECT_ID('AnotherDB.ASchema.ATable')
-- Gives NULL
SELECT OBJECT_NAME(OBJECT_ID('AnotherDB.ASche...
Hi
SSIS package is just importing from txt file to sql database. when we made the package were using old file and its executing fine.the old source file got (10 columns)
the new source file got 15 columns.
when the source file changed its failing.
[Flat File Source [1]] Error: Data conversion failed. The data conversion for column "Co...
Hello.
I have a computed column called Cost that returns money.
I want to have another column that returns (Cost * 2), but it doesn't allow me.
...
Hi, Does anyone know how I would go about concatenating a string in SQL Server 2005.
What I mean is something like the following scenario.
I have a nvarchar(MAX) column in a SQL Server 2005 database.
Lets say the column has a value of "A" and I want to add "B" making "AB", what is the simplest way to go about this. Will I need to do a...
how do i get this result into a new table?
SELECT DISTINCT h.CustomerCode, h.BillName, h.BillAddress1
FROM hist2 h
WHERE NOT EXISTS
(SELECT CustomerCode FROM tblCustomer c WHERE c.CustomerCode = h.CustomerCode)
...
How can I insert Armenian string to SQL Server database.
...