I am trying to figure out if it is possible to create a foreign key in this way.
First there are two parent tables in this scenario.
Table 1 has a PK int and another int column. When combined the two are unique.
Table 2 has a PK int and another int column. When combined the two are unique.
The paired value between the two ints is how...
We installed Service Pack 3 for SQL Server 2005 Standard Edition (64-bit). In the Add or Remove Programs menu we have the following entries under Microsoft SQL Server 2005 (64-bit):
Service Pack 3 for SQL Server Integration Services 64-bit) ENU (KB955706)
Service Pack 3 for SQL Server Notification Services 2005 (64-bit) ENU (KB955706)
...
hi guys,
i have a table called DrTimings ,in which Doctors time for each day is this.
**
DrID(int identity) StartTime(DateTime) EndTime(DateTime)
1 3/31/2009 8:00:00 AM 3/31/2009 10:30:00 AM
**
I have another table called TimeList which contain 3 fields
SlotID SlotStartTime(varchar) Sl...
I want a query that will return a row for each column in a view, and a row for the view itself.
There should be a column basetable in the result that gives the base table for the column in the current row, and a column basefield in the result that gives the name of the column in the underlying query (for renamed columns). It would be a ...
I have defined a variable as:
DateSecondsOffset Int default as 1
in a SQL Server Integration Service project. I use it as constant.
In a task, I have the following SQL to set another var NextDT:
SELECT dateadd(s, max(timestamp), 1) DT from myTable
I would like to replace the 1 with DateSecondOffset so that I can change it whe...
I have a CSV file with quote text delimiters. Most of the 90000 rows are fine, but I have a few rows that have a text field that contains both a quote and a comma. For example the fields value would be:
AB",AB
When Delimited this becomes
"AB"",AB"
When SQL 2005 attempts to import this I get errors such as...
Messages
Error...
Since I struggled a bit with this one and couldn't find a good online source with simple steps, here it is.
...
In SQL Server 2005, can you easily determine the last time someone queried a database.
...
I created a document management system for a client which uses SharePoint and SQL Server to store PDF documents. Due to some SAN misconfiguration 3 disks that were holding both MDF and LDF database files dissapeared from the OS one day. We are in the process of recovering the data of the SAN but my question is how do I detach an existi...
I'm running Windows Server 2003 x64 with 8GB RAM and SQL Server 2005 64 bit. I have SQL set to use loads of memory, but the SQL process only ever takes under 100 MB RAM. Is this normal? It is accessing data with indexes many GBs in size.
Moreover, no process is taking over 100MB, yet there is only a minimal (<100MB) amount ofree memory....
I have two tables:
Application
applicationid (int)
applicationname (varchar)
isavailable (bit)
and
Holidays
applicationid (int)
holidaydate (datetime)
I need to get the isavailable flag for any given applicationname but it should only return if the day if is not a holiday. The isavailable flag is independent of ...
I know this sounds backwards but I would like to be able to determine what authentication mode a SQL server is in prior to connecting with credentials. Is this possible?
In case you're interested, I'll briefly explain why...
The majority of the users of our product don't know, understand or even care about the database underlying their...
I have a database by name database1 and it contain a table by name of employee
In employee table have many fields like employee, name, salary etc etc.
by mistake i am change salary value 0 for all employee.
I am restore database from backup by name database2
Now i need assistance to update my current database which is database1
I wan...
I have a table called TimeList
SlotID SlotStartTime SlotEndTime
(int identity) (varchar(10)) (varchar(10))
1 8:00AM 8:15AM
2 8:15AM 8:30AM
3 8:30AM 8:45AM
4 8:45AM 9:00AM
5 9:00AM ...
Why does SQL Server insist that the temp table already exists! one or the other will happen!! , so it will never be the case.
declare @checkvar varchar(10)
declare @tbl TABLE( colx varchar(10) )
set @checkvar ='a'
INSERT INTO @tbl (colx) VALUES('a')
INSERT INTO @tbl (colx) VALUES('b')
INSERT INTO @tbl (colx) VALUES('c')
INSERT IN...
I need to create table on the fly in C#.net program. Task is to export excel file to SQL Database. How to write store procedure for creating table if column name and table name are passed as parameters? I tried to write following SP.
ALTER PROCEDURE dbo.CreateTempTable
@Param1 VarChar(50),
@Param2 VarChar(50),
@Param3 VarChar(50),
@Par...
I'm creating web site on local computer. i'm using SQL Server 2005 management studio. I need to copy all data to destination server. Destination server is SQL Server 2005. My problem is
when i using import/Export data for management studio, this only copy tables.
when i using backup and restore, tables and stored procedure shows lik...
Our database architecture consists of two Sql Server 2005 servers each with an instance of the same database structure: one for all reads, and one for all writes. We use transactional replication to keep the read database up-to-date.
The two servers are very high-spec indeed (the write server has 32GB of RAM), and are connected via a f...
hi guys,
i have time as 1:00PM.I have to convert to format '1/1/1900 01:00:00 PM'.Can anybody help?
...
I want to be able to insert data from a table with an identity column into a temporary table in SQL Server 2005.
The TSQL looks something like:
-- Create empty temp table
SELECT *
INTO #Tmp_MyTable
FROM MyTable
WHERE 1=0
...
WHILE ...
BEGIN
...
INSERT INTO #Tmp_MyTable
SELECT TOP (@n) *
FROM MyTable
...
END
The a...