In my answer to this SO question I suggest using a single insert statement, with a select that increments a value, as shown below.
Insert Into VersionTable
(Id, VersionNumber, Title, Description, ...)
Select @ObjectId, max(VersionNumber) + 1, @Title, @Description
From VersionTable
Where Id = @ObjectId
I suggested this because I b...
I'm working with SQL Server 2005 and have a single table:
int Code1,
int Code2,
real Val1,
real Val2,
real Val3,
Code1 & Code2 serve as a primary key and are part of the clustered index (only one index).
Each parameter occupies 4 bytes (each row occupies 20 bytes).
There are 24.5 million records in the table, fill factor is 100%, th...
I use SQL Server wizard to import csv files, however the rows imported appears in different order. How can I say to SQL Server to import rows in correct order.
...
I'm getting this error:
There is insufficient system memory in resource pool 'default' to run this query.
I'm just running 100,000 simple insert statements as shown below. I got the error approx on the 85,000th insert.
This is a demo for a class I'm taking...
use sampleautogrow
INSERT INTO SampleData VALUES ('fazgypvlhl2svnh1t5di','...
I'm looking to learn ADO.NET and such with SQL. However, i'm at home for the winter so I'm away from my school's servers which were configured already. I'm looking to run something like a local sql server and databases to just practice and learn with. I downloaded and installed MS SQL Server 2008 Express, but I don't know what to do with...
Is it possible to write stored procedure that works with a variable number of parameters? (in SQL Server 2005)
...
We have internal application used to publish articles, using SQL Server 2005.
For the task I need to save list of tags when a user publishes a post.
Should I make a separate table For Tags and update the ID column for a TAG with the id of the post that lists it, using XML column like
TABLE_TAGS
TAG_NAME varchar, ARTICLE_IDS XML
OR ...
I have 2 columns in my table, called TaskSet and SkillsSelected.
The sample data as follow:
TaskSet | SkillsSelected
--------------------------------------------------
SK000001, SK000004, SK000002 | SK000001, SK000002, SK000003
SK000002 | SK000002, SK000003, SK000004
As you can see it's ...
I need to define and generate primary key for 2 or more tables.
Tables hold same type of data but FOR Some BUSINESS RULES we have to make them separate say like
TableA = LOCAL_CUSTOMERS
TableB = INTERNATIONAL_CUSTOMERS
Both hold same columns like, CUSTOMER_ID C_NAME, CITY ....etc
While designing the Primary Key I want these keys to b...
Note: When I refer to tier, I mean a physical tier. Many of the questions on this site relating to "tiers" are referring to logical layers, which is not what I'm asking about.
I am designing an app using a standard "3 layer" architecture, with presentation, business logic (BLL) and data access (DAL) layers. The technology is WPF, C#, LI...
In my web application I write a query to check the userid and password. If userid is failed I write the query that it display userid is wrong if password is wrong then it display password is wrong. The query I write just returns int, but I want to return table or data row can you give me a solution?
This is my query:
user table consist...
I want to connect from a COBOL/VMS system to an SQL Server 2005 instance. Could someone point me to a driver that works well?
...
Hi
I have a Databse "Product" in in sql 2008.I have another Databse "ORDER" in sql 2008.
Both exist in different servers.
Now the requirement is to Merge both databases, and test pointing the applications to this new DB.
Can anyone suggest the best way to accomplish this without losing the information?
I have 2 options.
1) Script th...
I write a stored procedure for most viewed photos in my procedure, this is my procedure can u check this please is ok or is there any improvement required?
create procedure sp_photos_selectmostviewedphotos
as
select * from photos order by views desc
is it enough or required any modification
...
I’m using the new C++ builder 2010 and I’m upgrading a c++ program from c++ builder 6.
I have a case sensitive data database (SQL Server 2000) using the collation SQL_Latin1_General_CP1_CS_AS
I’m moving the data components from BDE to dbExpress. Using profiler I can see that when the components query systables / get Meta data its searc...
I write stored procedure for update.
create procedure sp_videos_updateviews (@videoid varchar(50),@ret int output)
as
set @ret = update videos set [views]=[views]+1
where videoid = @videoid
if(@ret>1)
begin
set @ret=1
end
else
begin
set @ret=0
end
but it is giving error like this
Incorrect syntax n...
How to download a word document which is stored in database, sql server as a content data through C#?
This is my Code I'm using:
string doctype = dtResumeInfo.Rows[0]["ContentType"].ToString();
string docname = dtResumeInfo.Rows[0]["FileName"].ToString();
//
try
{
Respons...
I have three tables.
tblLink: (LinkId, LinkName, GroupId, ,SubGroupId)
GroupId and SubGroupId are foreign key in tblGroup and tblSubGroup
tblGroup: (GroupId, GroupName)
tblSubGroup: (SubGroupId, SubGroupName)
in tblLink SubGroupId is allowed Null but GroupId is Mandatory.
I want to fetch LinkName, GroupName, SubGro...
I stumbled across a post on here regarding connecting to a DB with JavaScript.
http://stackoverflow.com/questions/857670/how-to-connect-to-sql-server-database-from-javascript
I'm building a gadget for windows vista/7 that will work with My Movies, a movie management app for Media Centre. The My Movies app uses SQL Server 2005 Express f...
I've created a web tracking system that simply insert an event information (click or page view) into a simple SQL server table:
Column | Type | NULL?
-------------------------------------
RequestId | bigint | NOT NULL
PagePath | varchar(50) | NOT NULL
EventName | varchar(50) | NULL
Label | varchar(50) | NULL
Val...