I'm having a strange problem with new Entity Framework for .NET 4
I have a SQL Server 2005 (EXPRESS) database and my service writes data to two tables using entity framework. Let's say tables are TableA and TableB. TableB has foreign key to TableA. In my program there are several threads that writes data in parallel. Each thread has its...
I'm trying to upload Excel (2003) file into Sql server 2005.
At present we are using SSIS to upload the file into a Temporary table (with defined schema) and then moving the data to their intended location using Stored procedure. This gives lots of errors due to datatype mismatch and sometimes null values are uploaded into table even t...
I've created a Back Up Database Task for a few selected databases in my server. What I want to do is to have only one backup file for any database. The new one could overwrite the old one or create a new one and delete the old one, doesn't matter. I've checked Backup set will expire: 2 days but but evidently this doesn't do what I though...
Is there a way to give a view a primary key in sql server. I know it is possible in oracle.
I am not concerned about updates its a read only view but someone else is using it in ms access so I would like the constraint that I know to be correct to be shown.
...
Hi
I am using SQL Server 2005. When I try to set the primary key constraint for a column in the alter statement. it committed error. i used this following query,
alter table "table name" modify(field__name integer(size) primary key);
can u say what the error actually.. expect ur valuable answer.. if u know other methods send me the q...
How can I automate process of running all SQL scripts from given folder ?
...
I have a table that has notes in it. It has a bunch of notes that automatically do different thing according to what someone does in the system.
When an order is assined it makes a note that says "Order was assigned to 'name'"
When an order is re-assigned it makes a note that says "Order was re-assigned to 'name'"
When an order is ass...
I need something like that which is of course not working.
insert into Table1
(
Id,
Value
)
select Id, value from
(
exec MySPReturning10Columns
)
I wanted to populate Table1 from result set returned by MySPReturning10Columns. Here the SP is returning 10 columns and the table has just 2 columns.
The following way works as long...
Here's my table schema
[dbo].[Action_History](
[ActionID] [int] IDENTITY(1,1) NOT NULL,
[objectID] [int] NOT NULL,
[object_mask] [varchar](max) NULL,
[description] [varchar](max) NOT NULL,
[action_by] [nchar](7) NOT NULL,
[action_date] [datetime] NOT NULL,
[response_required] [bit] NOT NULL,
[responded_da...
I have a varchar column in one of my tables with data like:
1234abc
1234abcde456757
1234abc Supervisor
1234abc456 Administrator
I want to "clean it" by removing any letters and numbers immediately following them so for the above examples I want to have:
1234
1234
1234 Supervisor
1234 Administrator
In another word, I want to keep th...
I'm trying in c# to simply pull a set of rows from a SQL DB and run through each row I get a result with some code that will email me one time for each row returned.
the below code should work as far as I can tell and returns no errors, I'm stumped. You can assume that the "ConnectionString" is valid and used in plenty of places on the ...
Hi,
We have mirroring set up between 2 SQL Server 2005 standard editions.
There are also mirroring alerts set up as follows:
DB Mirroring (Connection with Mirror Lost)
DB Mirroring (Connection with Principal Lost)
DB Mirroring (Principal Running Exposed)
DB Mirroring (Synchronizing Mirror)
DB Mirroring (Synchronizing Principal)
Mir...
I am trying to execute a CREATE TABLE which results in the following SQL exception:
Invalid object name 'UserLock'.
The statement looks like this:
USE [db]
GO
CREATE TABLE [db].[dbo].[UserLock] (
[Login] [varchar](150) NOT NULL,
[ExpirationDate] [datetime] NOT NULL,
CONSTRAINT [PK_UserLock] PRIMARY KEY CLUSTERED
(...
Hi all,
I am executing a storeproc in asynchronous mode from codebehind using sqlcommands BeginExecuteNonQuery or BeginExecuteReader method .
The storeproc returns multiple table as there are more than 1 Select statement.
I want to get those tables in a DataSet.
Is it possible?
Please help.
Thanks.
...
HI,
Using SQL server 2005 I have the following query:
SELECT
contact_id
,YEAR(date_created) AS giftyear
,SUM(amount_exc_vat) AS year_total_xGA
,SUM(amount_inc_vat) AS year_total_inGA
,COUNT(*) AS numGifts
FROM gifts
GROUP BY contact_id
,Year(date_created)
Which returns data that looks like this:
contac...
I am getting an SQLException "Operand type clash: int is incompatible with uniqueidentifier"
when I am trying to execute the below stored procedure from C# code.
create proc sp_Get_Allfields_Account_Public
@username varchar(20),
@password varchar(20),
@acc_num UniqueIdentifier out,
@cust_name varchar(20) out,
@balance float out
as
selec...
Hi,
I can't find an answer to this so if anyone knows of one please point me in the right direction.
A friend has created a few tables for me and used nvarchar(max) on around 4 of the columns in the table. Inserts and Updates are handled using stored procedures.
Am I right to worry that the executes of the stored procedures will error...
Yeah silly question. Its been a long time since I have designed a DB as a Database Diagram but the higher ups want to see it. I have totally become confused because I am a coder, not a DBA.
I have a main table which contains user id, name, username, password, etc. This main table has the primary key of ID. Should sub tables (such as add...
I am using ssrs 2005. I have a report with two tables.
table1
col11 col12 col13
1 2 3
table2
col21 col22 col23
a b c
d e f
g h i
It renders well on the report. When I export it to CSV, its bizarre...it exports this way
table1,col11,col12,col13,table2,col21,col22,col23 - The headers on the first line
...
I am trying to get only records that are the min date of the orderID
I have the following setup:
select
op.OrderID,
op.id,
MIN(op.Date) AS Date
From OrderPermits op
GROUP BY
Op.OrderId
op.id,
MIN(op.Date) AS Date
Orders has 1 to many order permits.
The problem here is that I am still getting duplicate order Id's when I only want th...