sql-server-2005

copy Ms access single Big Table to Sql server two small tables

Dear friends, I have single big table in Ms access 2k daabase and i need a way to copy this table and then populate my two already ready tables on sql server . I can use Migration tool but is there any way we can do it from Ms access like a form which executes the stored procedure or ODBC connection. what i am thinking is to create a ...

Select Fails With Nonexisitent Columns

Executing the following statement with SQL Server 2005 (My tests are through SSMS) results in success upon first execution and failure upon subsequent executions. IF OBJECT_ID('tempdb..#test') IS NULL CREATE TABLE #test ( GoodColumn INT ) IF 1 = 0 SELECT BadColumn FROM #test What this means is that something is co...

How to add composite primary key to table

create table d(id numeric(1), code varchar(2)) After I create the above table how can I add a composite primary key on both fields and also a foreign key? ...

How to add not null in table field

create table re(id numeric(1),bin varchar(10)) how to add not null on table as well as foreign key ...

eligibility for creating index

I have created script to find selectivity of each columns for every tables. In those some tables with less than 100 rows but selectivity of column is more than 50%. where Selectivity = Distinct Values / Total Number Rows So, is those column are eligible for index? Or, can you tell, how much minimum rows require for eligibility for creat...

Is SQL Server 2005 faster when table relationships are defined ?

I heard that SQL is faster if table relationships are defined. Is this true? Or maybe it's slower, I would like to know. ...

Hierarchial SQL Query

Hi, I have a self-referencing table (Customers) and a table that will link to one record in that table (Companies) i.e. Customers Companies ********* ********* ID ID ManagerID --> DirectorID ManagerID refers to another record in the Customer table. I need to perform a query where by given a specific customer I...

Script to automatically open SQL Server Management Studio 2005 from another interface

Hi everybody, Please I need help with a script that can help me open the SQL Server Management Studio 2005 from a button in an another interface. Thanks Roger ...

Script to automatically open SQL Server Management Studio 2005 from another interface

Hi everybody, Please I need help with a script that can help me open the SQL Server Management Studio 2005 from a button in an another interface. Thanks Roger ...

SSRS 2005 report page orientation with subreports

I have a report which is composed of several subreports. I need to render some of the reports as landscape and others as portrait. SSRS 2005 doesnt appear to support this behavior. Does anyone know if it is possible to get this behavior without having to hand roll a "report packager"? To be clear, the client wants to print one report wh...

How do I find which database uses a file

Using MS SQL Server 2005. On one of our servers we're running out of room, so I'm going through the databases, shrinking, removing, backuping etc. The largest file in the Data directory (an .mdf no less, not a .ldf) is not named according to our common naming-convention (it should reflect the database's name). I cannot move the file, s...

Import Open Excel File in Sql Server

Hi, I am running into an issue, while I import an excel file into sql server 2005 using OpenRowSet, it works fine when excel file is closed, If excel file is open it gives an error message. I have an excel file which is being updated 8 to 10 times in a minute by a third party software, I have to import this excel file into sql server 200...

Columns into row in custom format

I have a sql table called UsersInAuthentication like ----------------------- | AuthUserId | UserId | | 1 | 4 | | 1 | 5 | | 1 | 8 | ----------------------- I wish to get all users in format "(4,5,8)" as string with a single stored proc and If possible I also wish to insert,update,delete operat...

how to alter table Composite primary key

CREATE TABLE [dbo].[INVS_ITEM_LOCATIONS] ([DEPARTMENT_CODE] [varchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [IM_INV_NO] [numeric](10, 0) NOT NULL, [LOCATION_CODE] [varchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [CURR_QTY] [numeric](10, 0) NOT NULL CONSTRAINT [DF__INVS_ITEM__CURR___1352D76D] DEFAULT ((0)), [DO...

SQL Server 2005: Problem updating XML column from .NET TableAdapter

I'm trying to update an XML column in a SQL Server 2005 table. Access to this column is through a stored procedure. I'm using a .NET tableAdapter to call this procedure. The problem: The value of the xml column does not get updated. Some observations: I used SqlProfiler to see if the stored procedure call is actually sent to the SQL S...

Sql Server - DB Diagram with additional requirements

I am generating Database diagram from Sql server 2005 Professional edition. Clinet is coming with some Strange Requirements as : 1 ) DB Diagarm should show the tables with constraints,referred SP,referred UDF , Triggers. ( any utility available to do so ? won't it mess up the real DB meaning ? ). 2 ) The client needs the separate dia...

SQL server : Login issue while querying

I have a web application running with a SQL server 2005 DB as back end.I took the db back of the production site and restored in my development machine.Then i tried to query this database using the login "sa".When trying to execute the "select * from Customers" query, i am getting a message like "Invalid object name 'Customers" But when ...

Difference between analysis services and business intelligence development studio?

Hi guys, As you might have guessed from the title, I'm really new to analysis services. I've spent the last 5 hours (crazy!) just trying to figure out what is the difference between the analysis services avail. through SSMS and business intelligence development studio avail. through visual studio? Thanks ...

Changing vertical data into a table layout in .Net

I have a SQL Server 2005 output like this: Date | Result | Sum -----|--------|----- 8/26 | 01 | 1549 8/26 | 02 | 7972 8/26 | 03 | 4502 8/27 | 01 | 1897 8/27 | 02 | 1649 8/27 | 03 | 7949 8/28 | 01 | 8542 8/28 | 02 | 5335 8/28 | 03 | 4445 and I want it to show up (in a GridView?) like this: Result | ...

What should I do to get an Clustered Index Seek instead of Clustered Index Scan?

Hi, I've got a Stored Procedure in SQL Server 2005 and when I run it and I look at its Execution Plan I notice it's doing a Clustered Index Scan, and this is costing it the 84%. I've read that I've got to modify some things to get a Clustered Index Seek there, but I don't know what to modify. I'll appreciate any help with this. Thanks...