i have 2 tables unittypes,rules unittypes has unitid and description unitid description A1 description1 A2 description2 A3 description3 rules has id unitid 1 A1,A2 2 A1,A3 i am trying to get it to get a resultset like 1 description1,description2 2 description1,description3 the sql i wrote was select r.unitid ,(select distinct description from unittypes where unittypes.unitid [...]
Answer Question | June 4, 2009 12:50 PM
JOIN statement, SQL Server Query, SQL Server tables
CREATE VIEW [dbo].[vwResults] AS SELECT r.ResultsPK, b.PersonID, dbo.ltcPerson.FirstName, dbo.ltcPerson.LastName, dbo.ltcPerson.PersonFriendlyID, b.DateCreated, b.FormName, r.FieldName, r.ValueString, r.ValueNumber, r.ValueDate, r.ValueTextInt, r.ValueBit, b.UserID, b.BatchID, b.ParentID, r.Active, CASE WHEN b.ParentID = 0 THEN 0 ELSE 1 END AS IsChildRecord, CAST(b.PersonID AS varchar(4)) AS PersonIDStr FROM dbo.ltcBatch b INNER JOIN dbo.ltcResults r ON b.BatchID = r.BatchID INNER JOIN dbo.ltcPerson ON b.PersonID [...]
Answer Question | June 3, 2009 12:35 PM
SQL Server 2000, SQL Server Query, SQL Server query optimization
I want to query an SQL server database for specific tables and their descriptions. How do I do that? Is there a special tool needed to do this?
Answer Question | May 11, 2009 10:01 AM
SQL, SQL queries, SQL Server Query
Hii.. IT Professional Helper, may i asked 1 question and hope IT Professional Helper can help me to answer my question? The Question is : Cm.CommandText = “Update Reminder Set IsDatang = 0, IsValid = 1 Where TglReminder – TglDatangKembali > 7″ Cm.Execute If i get the error : Arithmetic overflow error converting expression to [...]
Answer Question | May 3, 2009 2:29 AM
SmallDateTime, SQL Server error messages, SQL Server Query
Hi, I have migrated a database from 2000 to 2005, updated the statistic and rebuild the index. When I run the following query “select top 500 * from myview order by name”, it is extremely slower in 2005 than 2000. The myview simply does an inner join with 2 table. The name is varchar(50). Strangely [...]
Answer Question | May 2, 2009 9:15 AM
SQL Server 2000, SQL Server 2005, SQL Server Query, SQL Server query optimization, VARCHAR
I am getting an error while running a qurey for excuting against OLE DB provide’ADSDSOobject’ Please advice Thanks Rajaa
Answer Question | April 26, 2009 3:34 PM
Active Directory, OLE DB, SQL Server 2000, SQL Server Query
We have a very huge SQL Server database, with approximately 700GB of data. Due to this, queries are running very slow. Could you please suggest few tips to improve performance?
Answer Question | April 26, 2009 2:46 PM
SQL Server, SQL Server databases, SQL Server performance, SQL Server Query
I have a set of records in a SQL query result. I only want to see one record, per the data field “ID”. I am getting 2 records for some ID’s, as there is one field that is different in the 2 records. This happens even if I start the query out with SELECT, DISTINCT, [...]
Answer Question | April 7, 2009 5:48 PM
SELECT statement, SQL Query, SQL Server Query
I need a T-SQL query to find a list of all database names and sizes from multiple SQL 2005 servers that are connected in a local network. Does one exist?
Answer Question | March 18, 2009 3:28 PM
SQL Server 2005, SQL Server Query, T-SQL
I have string like ’1,2,3,45,6,7,8′ I want to insert each comma separated value in a table column…my output look like this: COLUMN 1 2 3 45 6 7 8
Answer Question | January 18, 2010 6:38 AM
Comma-delimited, SQL, SQL queries, SQL Server development, SQL Server Query
How do I run a query that queries a SQL Server database and an Oracle server database, on two different servers, and uses all the data?
Answer Question | March 3, 2009 7:47 PM
Oracle, Oracle queries, SQL Server databases, SQL Server Query
Hello I have used text-function of SQL server 2005. I have ran my codes on a table with 800,000 records to serach for some specific words ( a list of 3milion words) in that. it took about 4 hours to be executed. Now I have some part of that table ( 1/8 of that including [...]
Answer Question | February 6, 2009 9:01 PM
SQL Server 2005, SQL Server performance, SQL Server Query, SQL Server Text Function
I have a table with Inventory transacation records. The table contains both Shipment (outgoing) and Receiving (incoming) transactions. I’m trying to write a report that lists both Sales Orders that result in Shipment records and Purchase Orders that result in Receiving records. If I link the Inventory Transaction table to the Shipment (Sales Order) tables [...]
Answer Question | February 6, 2009 10:39 PM
INNER JOIN, JOIN statement, LEFT JOIN, RIGHT JOIN, SQL, SQL queries, SQL Query, SQL Server development, SQL Server Query
Hello All, I have a requirement with sql server. Please find below the same. In database say we have a column named “Name” in a table. The records that are available in the table are say like Column_Name = Names Lean Metric Sequence Lean Operation Metric Lean Cleaning and so on…. Now, through some application [...]
Answer Question | February 10, 2009 3:35 AM
Query optimization, SQL, SQL Server development, SQL Server Query
I have a query for finding the fith lowest salary in a SQL database, and I am not able to understand how this query will be processed internally. It is: select * from emp a where 5= (select count(distinct sal) from emp where a.sal>=b.sal) Can you explain this to me?
Answer Question | December 29, 2008 7:54 PM
SQL Server, SQL Server Query
What is the difference between Outerjoin and Left outerjoin.
Answer Question | December 20, 2008 10:23 AM
JOIN statement, LEFT OUTER JOIN statement, OUTER JOIN statement, SQL Server development, SQL Server Query, SQL statements
How would I write a query to store an image file in a SQL Server 2005 table?
Answer Question | November 11, 2008 7:02 PM
SQL Server 2005, SQL Server Query, SQL Server tables
I am using OPENROWSET to output the result of a number of SQL SELECT statements into a spreadsheet. It works for most of the SELECT statements, but there are 4 random queries out of 82 that take more than an hour to execute. This is the code: insert into OPENROWSET(‘Microsoft.Jet.OLEDB.4.0′, ‘Excel 8.0;Database=D:MGTempESWIConvAuditQueriescnvWriteOff.xls;’, ‘SELECT Phone, Member, [...]
Answer Question | November 7, 2008 8:54 PM
OPENROWSET, SELECT statement, SQL Server, SQL Server Query
I have a stored procedure that runs on my Production database in 0.394 seconds. However, when I try to run the SP on a DEV box it takes well over 15 minutes to run *every* time. I have checked indexes and everything seems to be identical (I did a backup/restore to the Dev box in [...]
Answer Question | November 3, 2008 9:01 PM
SQL Server 2000, SQL Server 2005, SQL Server Query, SQL Server stored procedures, Stored Procedures