SQL Server 2005. I have a table with ColumnA bit, ColumnB int
Can I add a default value to ColumnB so that ColumnB is 15 if ColumnA is 1 and ColumnB is 0 if ColumnA is 0?
I know I could do this with a trigger but I my boss is prejudice against triggers (he needs trigger sensitivity training).
...
Hello,
The DBA displays a lot of info in his stored proc as it executes.
From a Visual Studio 2003 CSharp Windows Form,
when you launch a SQL Server 2000 stored procedure that returns records as well as an OUTPUT param,
is it possible to display the same verbose output as you would see in the Query Analyzer tool?
This is on top of sh...
In the SQL Server 2005 books online section "Defining Named Queries in a Data Source View (Analysis Services)", it states:
A named query can also be used to join multiple database tables from one or more data sources into a single data source view table.
Does anyone know where I can find examples or tutorials on how this can be don...
I would like to use essentially the same query in both T-SQL (SQL Server 2000/2005) and PL/SQL (Oracle 10g). Though it is not trivial, it is reasonably vanilla code, but it works in SQL Server yet fails in Oracle. My goal is to generate a count of rows for each unique upper/lower case combination of a particular field, omitting any field...
I'm trying to get the Foreign Keys for a table in my SQL Server 2005 database. I'm using the GetOleDbSchemaTable function right now:
DataTable schemaTable = connection.GetOleDbSchemaTable(
OleDbSchemaGuid.Foreign_Keys,
new object[] { null, null, null, "TABLE" });
This pulls back the right foreign keys, the only problem...
Consider a database server whose job today is to house one database. Likely the database will be moved in the future to another database instance which houses multiple databases & schemas.
Let's pretend the app/project is called Invoicer 2.0. The database is called AcmeInvoice. The database holds all the invoice, customer, and product i...
In a trigger, I have code like:
SET @var1 = (SELECT col1 FROM Inserted);
SET @var2 = (SELECT col2 FROM Inserted);
Is it possible to write the above in a single line? Something conceptually like:
SET (@var1,@var2) = (SELECT col1,col2 FROM Inserted);
Obviously I tried the above, without success; am I just stuck with the first method?...
Hello,
I'm very new to performance engineering, so I have a very basic question.
I'm working in a client-server system that uses SQL server backend. The application is a huge tax-related application that requires testing performance at peak load. Meaning that there should be like 10 million tax returns in the system when we run scenari...
Hi Folks, I have to write some information to SQL Server from a web application. But to minimize the delay I want it to be asynchronous operation using Message Queue.
I can create a Queue and post a Message (xml serialized object to be stored) to the queue.
What do I need to do to write that message from Queue to database?
...
Ok, i know CONCAT_NULL_YIELDS_NULL will always be set to ON in future versions of SQL (insert MSDN search params(yadda,yadda)) so bear with me.
Boring details: The platform is MSSQL 2000 Enterprise (v8 sp4) AKA Critatious Period Edition.
The following will evaluate to NULL
SELECT 'abc' + NULL;
Understandable. But you can circumve...
eg.
I have 2 tables Customers and Orders
Customers
has columns
CustomerID, Name
Orders has columns OrderID, OrderedOn
where OrderedOn is a DateTime
Now I want a query which will give me the
CustomerID OrderID and OrderTally
where OrderTally = 'Initial' for the first order
OrderTally = 'InMiddle' for everything in the middle
and
...
Hi All,
We want to create a c#/VC++ application by using which we should be able to create sql server database SNAPSHOTs in our own file format (in online manner).
And later we should be able to get data from those snapshots files in offline manner using our application ( i.e. we should be able to get number/names of tables/columns...e...
I am trying to insert into a table all data but change just the date column
So far I have something like
INSERT INTO MyTable (SELECT * FROM MyTable...)
What I want to do is set one of the columns to be a constant value (like todays date instead of what is selected out)
Does anyone know of an easy way of doing that
...
I have a storeprocedure:
CREATE PROCEDURE [dbo].[BrandDrugDetailsInsert]
@BrandDrugDetailsID uniqueidentifier OUTPUT,
@BrandDrugID uniqueidentifier
AS
BEGIN
INSERT INTO Pharmacy_BrandDrugDetails(BrandDrugID) OUTPUT INSERTED.BrandDrugDetailsID
VALUES (@BrandDrugID)
END
Anytime i try to retieve the value "@BrandDrugDetai...
I have this table:
Strawberries 2
Strawberries 3
Strawberries 4
Chocolate 3
Chocolate 4
Chocolate 5
Chocolate 6
Apples 3
Apples 4
Apples 5
Apples 6
My idea is to get the number of items, and the total of items per thing, like so:
Item Number Total
Strawberries 2 9
Strawberries 3 9
Strawberries 4...
How to identify if sql server 2005 express is installed using cmd
...
Hi,
I am converting an old application to use SQL Compact database (it works ok with SQ Server 2005 and 2008) and using the following code gives an error when attempting to execute a simple select command:
Private Const mSqlProvider As String = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;"
Private Const mSqlHost ...
I have to manage a log where i have to see the number of rows that are inserted by a transaction. Is there any way of doing it dynamically ?
...
Hi
I want to use SQL SERVER 2005 commands to generate tab-delimited file. I want to create a complex query and give it to something (say a function) to export data with columns names into a tab-delimited file.
If u don't know something doing this, suggest an idea that reduces the headache of doing it from scratch using C#.
AHH, I am...
Can any one of you help me to convert this query into dynamic query
DECLARE @Measure_Code nvarchar(50)
DECLARE @Transaction_Date datetime
DECLARE @Spec_Code nvarchar(max)
DECLARE @Error_Code nvarchar(500)
DECLARE @Operation_Status bit
DECLARE @Qury nvarchar(1000)
SET @Measure_Code = 'CFL_WATTS'
SET @Transaction_Date = 02/16/2010...