I have the table in SQL Server 2008. It has empId, which is the int of type. It is not identity for now. I want to write the query (so that I can maintain the record of changes in DB) to make this columns as identity column. This table have no data currently.
...
I'm working on a small standalone .NET app needs to refer to some tabular data and its only just selects and at most these tables have 250 records. Previously developers have used a SQL server database. Would i get a performance advantage if i simply convert the table data to XML and read from that?
Also is there any kind of performanc...
Hi all...
DECLARE @FINANCIALYEAR AS varchar(30)
DECLARE @FINALFINANCIALYEAR AS int
SELECT @FINANCIALYEAR=CONVERT(VARCHAR,YEAR(GETDATE())-2) + ', ' +
CONVERT(VARCHAR,YEAR(GETDATE())-1) + ', ' +
CONVERT(VARCHAR,YEAR(GETDATE()))
set @FINALFINANCIALYEAR = CONVERT(int,@FINANCIALYEAR)
print @FINALFINANCIALYEAR
i want final output in ...
Possible Duplicate:
sql server year
EXACT duplicate of sql server year
DECLARE @FINANCIALYEAR AS varchar(30)
DECLARE @FINALFINANCIALYEAR AS int
SELECT @FINANCIALYEAR=CONVERT(VARCHAR,YEAR(GETDATE())-2) + ', ' +
CONVERT(VARCHAR,YEAR(GETDATE())-1) + ', ' +
CONVERT(VARCHAR,YEAR(GETDATE()))
set @FINALFINANCIALYEAR = ...
In my application i want to insert XML document in to my table which has a column with XML datatype. Now issue comes when i use SqlBulkCopy in my application. i have to pass a Datatable to SqlBulkCopy.WriteToServer method. it is showing me InvalidCastException. for storing XML data in datatable, I tried to utilize Datatype property of Da...
Can anyone explain how this constraint functions and how its affects insertion of records into this table? Running win sql 2k5. Having issue with trying to insert data.
ALTER TABLE [dbo].[ws_shiptable] ADD CONSTRAINT [DF_ws_shiptable_ps_processed] DEFAULT (0) FOR [ps_processed]
...
I don't have much experience in SQL so I think this is not a dumb question.
I have 2 tables like this.
A .. G are the members of a hierarchy.
Now my requirement is as follows.
I need to filter out the members which
has status = 0 from Members table.
But, If the selected set contains
children which has a parent with
st...
Hi!
I'm writing a custom .NET MembershipProvider (not the built in one) and trying to update using Entity Framework. But of course i have no access to (Try)UpdateModel. How can i update it? Thanks in advance.
...
Hello.
I'm trying to get output value from DB via ADO.net. There's a client code:
using (var connection = new SqlConnection(ConnectionString))
{
connection.Open();
SqlCommand command = new SqlCommand("pDoSomethingParamsRes", connection);
command.CommandType = CommandType.StoredProcedure;
command...
If I want to execute stored procedure using the values returned from result set of a select statement. So number of times SP should get executed is equal to the number of result set from the select statement.
Is there any other way than using a cursor to do the above?
UPDATE
Can anyone please give sample code with While loop at least?
...
I have a table with the following fields. My requirement is to delete the records from the table when
1. The Flag is set to 'No'
2. For a title, in one record if the flag is set to 'No' and in another record if it is set to 'Yes'. Delete both the records. For example TH-123, In 1st record the flag is set to 'No' and in 4th record flag i...
Hi,
I was wondering if it was possible to determine from which column a coalesce value is drawn from?
I have the following example data (actual years range from 1989 - 2010 in data, not shown for brevity)
ID | 2000 | 2000 value | 2001 |2001 value | 2002 |2002 value | 2003 |2003 value | 2004 | 2004 value | 2005 | 2005 value...
Hello guys,
I'm getting started with building a Business Intelligence system using MS technologies.
I don't have any experience with Integration Services or with Analysis Services, so the learning curve is pretty steep for me.
I have been looking for samples and tutorials and found some nice stuff such as:
The AdventureWorksDW data w...
I'm creating a multitenant app where some of the tables need to have sequentially assigned integer values. The ordering is done independently for each tenant. As a concrete example, consider a Student table with a RegNumber column. RegNumber has to be assigned sequentially, but the sequence is local to each tenant.
The solution I'm thin...
Is there any thing from which we can faster get the no. of rows in a table instead of using count(1). Further there are two cases :
a) when we want to get the no. of rows in a table.
b) when we just want to know if there is at-least one row.
Thanks in advance.
...
This MSDN article states that:
An isolation level has connection-wide
scope, and once set for a connection
with the SET TRANSACTION ISOLATION
LEVEL statement, it remains in effect
until the connection is closed or
another isolation level is set. When a
connection is closed and returned to
the pool, the isolation level...
Hi All
I've converted a bunch of reports from Crystal Reports 7 to Crystal Reports 2008 as part of a migration from ASE (Sybase) to MS SQL Server. I also verified it via the "Set Database Location" option in Crystal Reports 2008. When I converted the reports I pointed them to one of my test databases (let's call this DB_a). I call the...
Hi,
I have a simple table
CREATE TABLE tItem (PK_Item INT ITENTITY(1,1) NOT NULL, ItemID VARCHAR(15) NOT NULL)
where ItemID is a generated identifier, generally a number, but can differ by customer and other conditions.
ItemID is a result of EXEC @TempID = pGeneralIdentifierRetrieve NULL, NULL, @ItemType
currently, I have insertio...
I am getting these "System.Data.SqlClient.SqlException" exceptions during peak hours on a high-traffic website (ASP.NET).
The full exception:
SomeMethodName
- Ex.Type: System.Data.UpdateException - Ex.Source: System.Data.Entity
- Ex.Message: An error occurred while updating the entries. See the inner exception for details.
- Ex.S...
Hello,
How would I go about generating a list of sql jobs and their owners? I would also like to be able to generate this list for SSIS packages also.
Thanks
...