My question is about limitation of clustered index on a table.
By theory, in a single table we can have only one cluster index. But what if I have datetime columns in a table say "From date" and "To date"? These columns will often required in WHERE clause to populate reports in my application. And if I also require a cluster index on pri...
I need to often run a query that aggregates data from different tables, something like
select
Name, Code, Date From TableA
union
select
Surname, TheCode, TheDate From TableB
union
[...] -- this stands for some more select statements
union
select
NickName, MyCode, getdate() from tableC
(the example is simplicistic, but it is like, this...
Hi can anyone give me an idea how to create an auto generated id like ED01,ED02 etc., so that when i am entering data the id should be automatically incremented
...
I need to export the data from 36 SQL tables containing 24GB of data into flat files, copy them to the client and import them there into the existing tables in his SQL database.
And I will need this for several customers (same tables, though).
How do I mass export and import data?
Is there a command line tool for this so I can write a s...
I'm in the planning stages of a Microsoft ASP.NET / SQL Server 2008 based web application and In thinking about database design, I began to think about injection attacks and what strategies I should employ to mitigate the database as a vector for injection attacks.
I've heard from various sources that using stored procedures increases s...
Hello, I have some tables in Sql Server. I want to log row, if row is updated or deleted. how can I organize this process?
Sample table structure:
[uniqueGUID] [uniqueidentifier] NOT NULL,
*[kod_a] [nchar](5) NOT NULL,
*[kod_b] [nchar](5) NOT NULL,
*[kod_c] [nchar](2) NOT NULL,
*[kod_d] [nchar](4) NOT NULL,
[nam...
When using Oracle you can create a disabled trigger specifing the word DISABLE before the trigger body. How can I achive the same effect in Sql Server?
...
I want to pass xml document to sql server stored procedure such as this:
CREATE PROCEDURE BookDetails_Insert (@xml xml)
I want compare some field data with other table data and if it is matching that records has to inserted in to the table.
Requirements:
How do I pass XML to the stored procedure? I tried this, but it doesn’t work:[...
For the last 3 hours I've been trying to figure out how ADO.NET works with no success. Could someone point me at a great tutorial or somethign similar? I am trying to build a DB from scratch and working with it in my WPF program.
I have worked before with JDBC and sqlite but I didn't find a tutorial from zero to a DB where I can connec...
Hi,
I've tried to read an article on locks and deadlocks, and it just doesn't land, al the different kind of locks.
We're running 2 different processes which try to edit records in the same table.
The first process reads the new data and sends it to an external party and updates the status accordingly, the other one receives the receive...
Looking a solution for strange JTDS error message: Could not find a Java charset equivalent to collation 2C04D01000.
I tried to pass file.encoding and user.encoding parameters without any success.
...
Hi all,
I'm interested in whether a select for update query will lock a non-existent row.
e.g.
Table FooBar with two columns, foo and bar, foo has a unique index
Issue query select bar from FooBar where foo = ? for update
If query returns zero rows
Issue query insert into FooBar (foo, bar) values (?, ?)
Now is it possible that t...
I have a table with the following schema :
ID , CatID, ParentCatID, SiteID
I want to get all the sites that belong to the categories that are the roots ( means their ParentCatID = 0) and all their descendants.
for example :
ID , CatID, ParentCatID, SiteID
--------------------------------
1 , 2 , 0 , 3
1 , 4 , 2 ...
I'm running the following query in a PHP ODBC connection to a MSSQL sever:
DECLARE @weekStart SMALLDATETIME;
SET @weekStart = DATEADD(d,0, DATEDIFF(d,0,GETDATE())); -- weekStart = TODAY @ 00:00:00 -- per http://weblogs.sqlteam.com/jeffs/archive/2007/01/02/56079.aspx
SET @weekStart = DATEADD(d, 1-DATEPART(dw, GETDATE(...
Hey all, I am trying to find out how to copy data from one table to another database table. I have two connections to two different databases. Ones called comp-DEV1 and the other SQLTEST. I am currently unable to copy data from my sorce table (SQLTEST) to my destination table (comp-DEV1).
This is the error:
Msg 102, Level 15, State ...
A recent blunder was made where the Bug Tracker .NET software was removed from our server;
now we don't have a backup of the installer that was used, only the database. Is there a way to determine the version of Bug Tracker .NET supported by the database backup just based on the schema alone? without manually sifting through the differe...
I have a previously developed project that I am working on now. The project uses SubSonic 2.1 as ORM and it has been working fine since we decided to move to a newer server. The new server has SQL Server 2008 SP1 and now SubSonic is not behaving as usual.
I debugged the case and found that SubSonic is now generating ANSISQL queries inst...
Need to duplicate a TABLE using Microsoft SQL Management Studio 2008
The TABLE needs to duplicate all table row (Primary Key) ID as well.
Thanks.
...
I am trying to move reports that currently run in SQL Server to Crystal Reports.
Essentially the statement I want to reproduce is:
SELECT DATEPART(DD,DATE), COUNT(*)
WHERE FOO = 'BAR'
GROUP BY DATEPART(DD,DATE)
Count the occurrence of records that match a criteria, grouped by date.
I have used the Selection Expert to generate a e...
Let's say I have a column in a table where the datatype is XML. I have a specific value I want query for in an xml tag that is unique(no repeating) in the XML. How do I do this?
Something like:
select * from MyTable
where XMLColumn.TagImLookingAt.Value = @QueryValue
...