I have a table with a primary key, but I want two other columns to be constrained so the combination of the two is guaranteed always to be unique.
(a dumb example: In a BOOKS table, the IBAN column is the primary key, but the combination of the Title and Author columns should also always be unique.)
In the SQL Server Management Studio ...
The query is:
CREATE TABLE logfile (
sequence_number BIGINT,
start_time DECIMAL,
finish_time DECIMAL,
irp_major VARCHAR(100),
offset BIGINT,
length BIGINT,
filename VARCHAR(2000),
is_seq BIT
);
//bulk insert 120 000 rows
CREATE CLUSTERED INDEX IX_logfile ON logfile(sequence_number);
UPDATE dbo.logfile SET i...
My database isn't actually customers and orders, it's customers and prescriptions for their eye tests (just in case anyone was wondering why I'd want my customers to make orders less frequently!)
I have a database for a chain of opticians, the prescriptions table has the branch ID number, the patient ID number, and the date they had the...
i have simple table with two fields: ID and Date
how can i do Select that will return true or false, of course without Scalar-valued Functions
it must be something like that:
SELECT (Date < getdate()) as mu_value FROM my_table
...
Suppose I had a table with a large number of records, I wanted to update all the record in that table using SQL Server managment studio 2008, I typed:
Update Table set col1 = val
It will take a while for this command to update all the records, now if I pressed stop excutioin, what exactly will happen, some records will be upodated and co...
I have a database with regular full-text catalogs. I want to detach this database, copy it to a different server and attach it under a different name (same name but with '_BAK' appended to it). I am using SQL Server 2005.
Here is the error trying to attach DATABASE with full-text catalogs under the name DATABASE_BAK
Warning: Identity ...
Both these joins will give me the same results:
SELECT * FROM table JOIN otherTable ON table.ID = otherTable.FK
vs
SELECT * FROM table INNER JOIN otherTable ON table.ID = otherTable.FK
Is there any difference between the statements in performance or otherwise ?
Does it differ between different SQL implementations ?
...
Using C# (vs2005) I need to copy a table from one database to another. Both database engines are MS SQL 2005. For the remote database, the source, I only have execute access to a sproc (stored procedure) to get the data I need to bring locally.
The local database I have more control over as it's used by the [asp.net] application whic...
In management studio you can see the owner under properties but it won't let you change it. My guess is there's some stored procedure to change it and you can't do it through the gui.
...
For cost savings, we're moving from an managed SQL Server DB to a dedicated db on our own server.
What configuration checklist would you perform to ensure maximum security and reliability?
...
I am trying to connect to Teradata using a Linked Server in SQL Server 2005. When I try to use SQL Server to connect using OPENQUERY, I get the following errors:
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "TDOLEDB.1" for linked server "TERADATA" reported an error. Access denied.
Msg 7350, Level 16, State 2, Line 1
Cannot g...
I am stuck with a problem of implementing security at dimension level in SSAS. Here is what I did -
1. Defined a role in SSAS and applied security at dimension level (Unchecking cube dimensions that I don't want this role to access and setting Allowed & denied Sets).
2. Tested using Cube Browser, it worked fine.
3. Tested using SSRS, no...
Typical ISP setup. One server is the web server, another is the DB SQL server. There is a local administrator account, let's say XYZ, created on both machines. So when I log in remotely, I am either WebServer\XYZ or DBServer\XYZ, depending where I log in.
Now, when I login to SQL Server SSMS on DBServer using Windows Authentication, ...
I have data in a MSSQL table (TableB) where [dbo].tableB.myColumn changes format after a certain date...
I'm doing a simple Join to that table..
Select [dbo].tableB.theColumnINeed from [dbo].tableA
left outer join [dbo].tableB on [dbo].tableA.myColumn = [dbo].tableB.myColumn
However, I need to join, using different formatting, bas...
How can I get only the Date part of a DateTime ? I'm searching for something like year() function but for the whole date.
...
After much research I am a little confused by which identity tracker I should use in sql.
From what I understand scope_identity will give me the last id updated from any table and ident_current will will return the last id from a specified table.
So given that information it would seem to me the best version to use (if you know which ...
When developing an application with lots of stored procedures, should you store them in some sort of source versioning system (such as source-safe, TFS, SVN)? If so, why? And is there a convenient front end way to do this with SQL Server Management Studio?
...
I am trying to get our company's database objects stored in source control. We are going to be stuck using Aldon LM for our source control program. What is the best way to deploy scripts that we create to our SQL Server environments automatically from source control?
For our .Net web applications, we have configured Aldon to push ou...
I have transactional replication running between two databases. I fear they have fallen slightly out of sync, but I don't know which records are affected. If I knew, I could fix it manually on the subscriber side.
SQL Server is giving me this message:
The row was not found at the Subscriber when applying the replicated command. (S...
I have a pair of SQL Servers at different webhosts, and I'm looking for a way to periodically update the one server using the other. Here's what I'm looking for:
As automated as possible - ideally, without any involvement on my part once it's set up.
Pushes a number of databases, in their entirely (including any schema changes) from on...