sql-server

How to stop Rounding Values in SQL Server Integration Services?

I'm using the SSIS package, there is nothing being changed from source to destination. However, the column which I'm paying attention right now has a slightly different datatype (which I hope doesn't matter) in the source and destination; the source has numeric (15,2) and the destination has numeric (16,2) and the data in the source is 4...

Calling Stored Procedure on classic ASP page

I've been struggling all day calling a Stored Procedure from a classic ASP page. I have a few basic noobie questions. First, is this the best way to add a parameter to my command: cmd.Parameters.Append cmd.CreateParameter("@SubmissionDate", adDBTimeStamp, adParamInput, , txtDate) Second, is adDbTimeStamp the proper type to use when ...

Filtering a form with subforms in Access

In a SQL database I have a table, Table1. This table is related to another table, Table2 which in turn is related to Table3. There is a query Query1 that selects certain records from Table1. This database is linked to in an Access database project A form Table1Data is based on Table1, with a datasheet containing related Table2 data (an...

One in Ten Query in SQL Server very slow.

When running a very simple query in SQL Server 2000. SELECT getDate() Most queries are sub second, but one query randomally in 10 takes about five seconds. I am running these queries from SQL Server 2008 Management studio, but it occurs in other clients and on other machines as well, so it is not client specific. The query is running...

How many tables is "too many" in a single SQL SELECT?

As a DBA for MS SQL 2000 and 2005, I regularly see giant select queries JOINing 7-10 or even more tables. I find, though, that there is a certain point past which performance tends to suffer, and the query becomes very difficult to debug and/or improve. So is there a "rule of thumb" for when I should be considering other query methods, ...

Taking an average in SQL after throwing away outliers

I have a generic log table which I can attach to processes and their results. I get the average time using a process performance view: WITH Events AS ( SELECT PR.DATA_DT_ID ,P.ProcessID ,P.ProcessName ,PL.GUID ,PL.E...

Paging through Large table in sql 2005

I have a table with 15 columns and 6.5 MILLION records. I need to access this table from the C# side with help of paging. I have written an SP but it takes about 1.30 mins to retrieve the data. here's my Stored Proc - Create Proc demo ( @startRowIndex int, @maximumRows int ) AS DECLARE @first_id int, @startRow int SET @startRowIndex ...

Need help creating this Sql query.

Hi folks, I'm trying to create the following sql query (as in, this is an example of the final query) :- DECLARE @SearchQuery AS NVARCHAR(100) = 'yellow bird' SELECT Id, Name FROM dbo.FooBars WHERE CONTAINS(Name, N'FORMSOF(Thesaurus, yellow)') AND CONTAINS(Name, N'FORMSOF(Thesaurus, bird)') Notice how i've got two 'CONTAINS' line...

Transfering data from one database to another

I have two databases, lets say Database A and B, with different datastructures. In Database A there is a table contacts. In Database B there is a table Accounts. I want to transfer data from Database A table contacts to Database B table Accounts. I am use SQL Server 2005 and want to write sql scripts to do this. Can someone tell me wh...

How can i change datetime format in sql?

How can i change dateformat?Forexample: 2009-06-10 10:16:41.123->2009-June 2009-05-10 10:16:41.123->2009-May ...

SQL query for top and bottom value for a particular date

SQL Server 2000 My Table: CARDNO CARDEVENTDATE CARDEVENTTIME 121 20090610 025050 121 20090611 040000 121 20090611 050000 121 20090611 020000 122 20090611 030001 122 20090611 030000 123 20090611 080000 123 20090611 100000 123 20090611 132449 123 20090611 025959 124 20090610 030000 124 20090612 030001 125 20090611 030002 125 2009061...

Concatenating rows from different tables into one field

Hi! In a project using a MSSQL 2005 Database we are required to log all data manipulating actions in a logging table. One field in that table is supposed to contain the row before it was changed. We have a lot of tables so I was trying to write a stored procedure that would gather up all the fields in one row of a table that was given t...

ActiveX cannot create object vb6 application with crystal report8.5

I inherited a program from my late dad its developed with vb6 and has sql server 2000 as the back end. when i try to print a report from the application it gives the error message "ActiveX cannot create object" but when i view the report from crytal report it displays everything. Please i need help ...

Using LINQ2SQL to insert a large number of records...

We have a small c# tool that we threw together to parse a data file, build up some objects and insert them into the DB. The logic is essentially. string [] lines = File.ReadAllLines("C:\\Temp\\Data.dat") foreach(string line in lines) { MyDataObject obj = ParseObject(line); myDataContext.MyDataObjects.InsertOnSubmit(obj); } my...

SqlServer is in script upgrade mode

Vista just finished one of its many updates. After restarting my computer I try connecting to SqlServer2008 instance with Sql Server Management Studio and I get this error: Error connecting to '...\MSSQLSERVER2008'. Additional information: Login failed for user '...'. Reason: Server is in script upgrade mode. Only administrator can conn...

SQL Server 2000 job failure from DTS package versions?

I've been having a reoccurring problem that escapes me at this point. I have a job set up in SQL Server 2k that has a few command steps which are followed up by 4 steps that just call DTS packages on the same server. When it comes to calling the packages, the job fails with no real reason given. Ok fine... Well the thing that I can't...

Duplicate columns values within a table

Hi, My scenario is I have a table with columnxs A, B, C and D. A is the PK and B and C are both foreign keys. I intend to add an exta column to this table E, the side effect of this within the application is it will cause a row to be inserted after which there will be duplicate values within columns B and C. Does this break any refere...

Why would linked servers be prohibited?

I work in a corporate environment where the creation of linked servers is absolutely prohibited. I've asked the DBA's the reason and the only answer I ever get is, "That's the policy". So I find myself having to write and make use of SSIS packages to move data between databases when such a need arises. Can anyone tell me what reasons ...

SQL Server - Adding an XML Index to a calculated column on a View

I have a table which stores comma separated values in an NVARCHAR(MAX). I have created a view, which uses string manipulation to convert these comma separated values into an xml list. I can then use this Xml column access each item. The queries on this column will benefit greatly if I could index it. However, on trying to create a Prim...

MS SQL Server fastest way of changing column definition

Hi, I am tasked with changing a table's column datatype from smallint to int for a table that has 32 million rows in it. The requirement is to have the lowest downtime possible (basically the fastest way of achieving this). We are using SQL Server 2000. Please help! ...