Background
I have a spreadsheet of data that I'm importing into SQL Server 2005. I'm using the Import Wizard in Management Studio to do this.
Problem
I'm importing the data into Table A. Table A has a foreign key reference to Table B. My spreadsheet contains a value in Table B and I need the key for that value so I can put it into Ta...
I want to create a query to list of all user defined stored procedures, excluding the ones that are system stored procedures, considering that:
Checking the name like "sp_" doesn't work because there are user stored procedures that start with "sp_".
Checking the property is_ms_shipped doesn't work because there are system stored proced...
I am trying to speed up a long running query that I have (takes about 10 minutes to run...). In order to track down what part of the query is costing me the most time I included the Actual Execution Plan when I ran it and found a particular section that was taking up 55% (screen shot below)
This didn't quite seem right to me so I add...
I am having following issue.Even after case insensitive collation. SQL server is treating @Result and @result differently. Am i missing something.Please help.
SELECT DATABASEPROPERTYEX('OA_OPTGB_0423', 'Collation') SQLCollation;
SQL_Latin1_General_CP1_CI_AS
DECLARE @Result varchar(2000)
SELECT TOP 1 @result = addr.address_id
...
A very simple MSSQL command is giving error.
create table emp (empid char(6));
insert into emp values(3);
ALTER TABLE emp MODIFY empid char(10); //The error line :@
Error >Line 1: Incorrect syntax near 'empid'.
It's mindboggling, either the day is not mine or All Hail MS :P
Any resolutions?
...
How to retreive the last row of a table which doesn't has any unique id like
select * from sample where id=(select max(id) from sample)
...
I have a query to return how much is spent on-contract and off-contract at each location, that returns something like this:
Location | ContractStatus | Expenses
-------------+----------------+---------
New York | Ad-hoc | 2043.47
New York | Contracted | 2894.57
Philadelphia | Ad-hoc | 3922.53
Seattle ...
I have a table as follows
Name | Words
A words for A1 here
B words for B1 here
C words for C1 here
A words for A2 here
B words for B2 here
C words for C2 here
I want to pivot the above table to get the following result
A ...
As a preface, I am brand new to using SQL Server 2005; I know how to use the SELECT, UPDATE, DELETE, and INSERT commands and that's about it. I am also using Express Edition on my local PC (E8400 processor, 8GB of DDR2-800, 2 x 640GB SATA-II HDD in RAID 1)
I have a table that I set up with 8 columns, all are NVARCHAR(Max) and I allow Nu...
If I apply Binet Formula and Recursive formula for finding the fibonaci series, there is a discrepancy in result. Why?
Basically I am a student and it is our assignment to implement the fibbonacci series. So I while making the experiment I came across this situation.
Thanks in advance
...
Possible Duplicate:
Synchronize data between .dbf files and Sql Server 2005
I have a legacy application written in Delphi and having .dbf files. I have to recreate some part of that application in ASP.NET using SQL Server 2005. I have to sync both databases as user will access Delphi application as well as ASP.NET application.
...
The code
ALTER PROCEDURE [dbo].[spSocial.QuestionsAddNew]
@IdUser int,
@IdQuestionCategory int,
@Title int,
@Body int,
@CreatedDate int,
@ActivityDate int,
@VotesCount int,
@AnswersCount int,
@ViewedCount ...
ADODB Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I downloaded the odbc driver for PHP. I pasted that driver in the PHP ext directory, then I get the error. Can anybody help me?
...
For my database application, employing snapshot isolation for certain of its queries' transactions seems perfect for solving one of the critical requirements.
I'm worried, though, how choosing snapshot isolation (which I believe must be enabled database-wide) now will bite us once we start getting very high volumes. What is the cost of...
Does disabling triggers count as schema change in SQL Server? I am getting error: "Could not complete cursor operation because the table schema changed"
I have a stored procedure p_DeleteA that deletes a row from table A and all of its child records from table B; however, as a row in the table B gets deleted, grandchild records in table...
Is there any way of adding custom text in an computed column?
For example this formula works great ([Duration] + '12')
Could i have a result, from a computed column, similar to this one?
([Duration] & ' MyCustomText')
Can i add custom text in a computed column? Or am i asking too much?
...
When creating a new database with SQL Server Express 2005, the database files (.mdf and .ldf) get stored in C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data by default.
However, with the tutorials I've seen for ASP.NET MVC (e.g., Nerd Dinner), it seems to be common practice to keep the database files in the ASP.NET project's App...
How do you return the max value of several columns (date and cost relationship)?
TableName [ID, Date1, Cost1, Date2, Cost2, Date3, Cost3]
I need to return something like this: [ID, Most Recent Date, Cost]
I need to return something like this:
ID
Most Recent Date
the Cost related to the Date (if the most recent date is Date1 so th...
Hello,
While implementing a hierarchy / tree structure on a SQL server 2005 database, I'm getting very slow query response ( below queries talking more than 5 sec ) when using LIKE clause combined with the EXISTS clause.
The slow queries involve two tables - [SitePath_T] and [UserSiteRight_T] :
CREATE TABLE [dbo].[UserSiteRight_T](
...
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...