Archived Months
January 2003
March 2003
April 2003
May 2003
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
April 2008


all groups > sql server programming > may 2006 > threads for wednesday may 3

Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

booking db design help
Posted by sammy at 5/3/2006 11:52:45 PM
Hey Guys, I am trying to create a web app that uses an SQL db to handle employee scheduling. I can design a table to hold the appointments with no problems but I need to be able to search for free time for the employees. all bookings are based on 30 minutes blocks. So far I managed to create ...more >>

Renaming Foreign Key
Posted by Anchi at 5/3/2006 9:40:59 PM
Hi, Does anyone know if there's a way of renaming a foreign key? Or even name the foreign key on key creation? Thanks ...more >>

DBCC CHECKDB
Posted by nate.vu NO[at]SPAM gmail.com at 5/3/2006 9:27:10 PM
Hi, Just got a question about the way DBCC CHECKDB works.... When I run a DBCC CHECKDB statement against a database, are all the pages for that database read from the disk (i.e. if there are pages for the database in the buffer cache then these are not used)? Thanks ...more >>

question
Posted by joe at 5/3/2006 6:43:02 PM
what is the meaning? set ANSI_NULLS ON set QUOTED_IDENTIFIER ON and can i know the stored procedure create/modify date?...more >>

Multiple Records Subquery..
Posted by den 2005 at 5/3/2006 6:21:01 PM
Hi everybody, I like to display the records for AccountNo = 221 from table records shown below, how would I do this? I am display this results in a crystal report. What is sql statement to do this? Thanks. Sql Statement: (this statement is not allowed) Select AccountNo, RecordID, (Sele...more >>

User Defined DataType
Posted by Lianne Kwock at 5/3/2006 5:52:01 PM
Hello, I received the following error when I was trying to use one of User Defined DataType in creating a table on remote database server. The error message is as follow: Server: Msg 2715, Level 16, State 7, Line 1 Column or parameter #4: Cannot find data type test. However, I can cre...more >>

Float vs Decimal
Posted by Bassam at 5/3/2006 4:51:07 PM
Hello, sorry if this question is silly I'm confused about difference between Decimal and Float data types , if im writing accounting application and use 10:4 as precision/scale in all numbers , does it matters if i choose fields as Decimal or Float in that case ? in BOL its says about floa...more >>

Accessing data in a different database?
Posted by Linn Kubler at 5/3/2006 4:38:43 PM
Hi, I'm using SQL Server 2000 and I would like to make a view in one database that returns data from a second database on the same server/instance of SQL Server. Is this possible? If so, how? Thanks in advance, Linn ...more >>



Using SQL Server and C# to make simple version control system
Posted by bob_jeffcoat NO[at]SPAM hotmail.com at 5/3/2006 4:33:58 PM
Hello, I make a CAD program and I'm planning on creating a simple product database to control the versions of my customers CAD files. The database will only have a couple of tables, the main one having these fields: id name manufacturer XML of CAD data (which can be loaded by m...more >>

WHERE performance issue
Posted by Brandon Lunt at 5/3/2006 4:18:01 PM
I saw two previous posts on this topic with no answers. I run identical queries, one using a literal value, the other using a variable. The query that runs using a variable in the WHERE clause takes 30-40 seconds to run as opposed to the literal that runs in under 1 second. I checked the ex...more >>

Differences in error handling between 2000 & 2005
Posted by Nick at 5/3/2006 4:01:20 PM
The following code is executed within a stored procedure, written for SQL Server 2000: SET @BI = "BULK INSERT " + @TableName2 + " FROM '" + @path + "\"+ @TableName1 + "' WITH ( FORMATFILE = '"+@formatPath + "\"+ @TableName + ".fmt' , MAXERRORS=0, BATCHSIZE=500000,CHECK_CONSTRAINTS, ERRORFILE...more >>

Appending text to a text field type
Posted by wnfisba at 5/3/2006 3:05:02 PM
I have the following code which properly appends text to exisiting text, but I also need a carriage control line feed so that the appended text will appear all the way to the left when we view it through the application. Can anyone help me with appending text to a text field type and also p...more >>

Email address in stored Procedure parameters
Posted by Pantano Antonio at 5/3/2006 2:59:01 PM
Hi, i'm writing a simple sp that check if an email address already exist in an AddressBook table. This sp expect a parameters called @Address. When i call this sp and pass to it an email address which contains an at character (@) the stored procedure will return no values. i think the @ alt...more >>

Which data types for currency?
Posted by Alex Clark at 5/3/2006 2:47:36 PM
Hi, I know to many of you this will sound like a daft question, but what are the best data types for storing currency values (assuming I'm going to be performing arithmetic operations on them and don't want crazy rounding issues)? Obviously 'float' & 'real' are out of the question, but I...more >>

Update field based on previous record (incremental)
Posted by curtmorrisonemail NO[at]SPAM gmail.com at 5/3/2006 2:12:57 PM
I have the following table that I want to update: COL1 COL2 ==== ==== 0 8 1 12 3 20 15 10 etc... For the first record, COL1 starts at 0. For each record thereafter, I need COL1 to increase by adding the value of COL2 from the previous record, plu...more >>

Can CTE be used inside a FROM subquery?
Posted by Deepak Puri at 5/3/2006 2:12:13 PM
This issue came up in the MSDN Analysis Services Forum, so I was wondering if there's any workaround: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=380689&SiteID=1 When a Named Query is used in lieu of a table in an SSAS Data Source View (DSV), the generated SQL query apparently emb...more >>

Newbie - Query with loop?
Posted by kat at 5/3/2006 2:12:02 PM
Howdy, I am relatively new to Transact SQL and need some help on what should be a simple query... I have a table with * Item * Cost * MonthEndingDate (e.g. 1/31/2006, 2/28/2006) I need a query to return the Cost for a given month, but if the cost is null or there is no record, I nee...more >>

Let me rephrease the question.
Posted by Justin at 5/3/2006 1:43:45 PM
I hope I can better explain. I have a column that stores unicode (nvarchar). I am well aware that unicode equivalent for ascii characters. Now if the data does contain non-asii characters, I want to retreive it and if the data is nothing but ascii characters, I want to filter out. Here...more >>

Date question, Can I get Q1, of 2006 begin and end dates?
Posted by TallMike at 5/3/2006 1:36:02 PM
I would like to get the first and last day of a quarter by passing in todays date. I can get the quarter were in with select (DATEPART(Quarter,GetDate())) Now I want to get the day the quarter started (Min day of the quarter) and the Last day of the quarter (Max day of the quarter) i...more >>

Multiple WHERE replacement???
Posted by Vito D at 5/3/2006 1:28:21 PM
Hello, I have a table relationship that connects a list of Amenities provided by each Property, such as: Properties --------------- PropertyID int PropertyName nvarchar(100) Amenities --------------- AmenityID int AmenityName nvarchar(50) PropertyAmenities --------------- P...more >>

BCP with Windows authentication?
Posted by Rick Charnes at 5/3/2006 12:44:08 PM
We've been using BCP.EXE for ages, but are now connecting to our databases via Windows authentication rather than SQL ID's. How can I get BCP to connect via Windows authentication? Thanks....more >>

Need to do the following...any suggestions?
Posted by Ben at 5/3/2006 12:30:02 PM
i need to be able to run the following code SELECT NULL, 'N/A', 0 UNION EXEC spListSubgroupsByGroupID @param Basically, I need to add an additonal row to the results that enters a null value. I cannot change the spListSubgroupsByGroupID stored procedure. any suggestions? thanks....more >>

Help with Arithmetic Overflow error
Posted by 7racer NO[at]SPAM gmail.com at 5/3/2006 12:26:03 PM
Hi. I could use some help troubleshooting an error in a stored procedure. The SP was developed some time ago and recently started thowing this error: Arithmetic overflow error converting numeric to data type numeric. This error doesn't seem to make much sense since it happens when inserti...more >>

SMO - SQL Server 2000
Posted by Tony HInkle at 5/3/2006 12:23:02 PM
Can anyone tell me what needs to be done so that the following code, which works successfully for SQL Server 2005 systems, will work with SQL Server 2000 systems. The documentation says that SMO works with SQL Server 2000 systems, but I haven't found any information about any components tha...more >>

Simple but useful technique - is it possible?
Posted by Uday at 5/3/2006 11:52:01 AM
Lets say, I have two groups of numbers (1,2,3,4,5...) and (1,8,3,6,1,4,...) [doesnt matter what the numbers are, as long as they are numbers] If I want to get a list of matching/non-matching numbers using a query, without creating any tables.... like: -- all numbers in g2 that match with ...more >>

Fill in missing date ranges
Posted by Terri at 5/3/2006 11:12:40 AM
I have a table AssetValues that contains several rows of data for a particular date. The table has missing dates and I need to populate these missing dates one-time to create historical data and then daily to populate missing data on an ongoing basis. The missing dates are not related to the par...more >>

Update Conflict
Posted by Tanweer at 5/3/2006 11:02:01 AM
Appreciate if you guys can resolve my issues I am trying to write a store procedure that can handle Update Conflict Senario to be handled --Row was deleted --Row was modified by other user --Row is locked What is the best way to do it in Stored Procedure also is Timestamp field is good c...more >>

How can I print column name only from table?
Posted by coke at 5/3/2006 10:55:02 AM
Is there some Sp out there?...more >>

Select List question.
Posted by hazz at 5/3/2006 10:26:36 AM
I would like the 'select list' in a select statement to be generated as follows; Query A - select (output from Query B) from sometable. Query B - select Column_Name from ColumnsToSelect where Include_in_Report = 1 How can I 1. add commas between the columns values which are deri...more >>

How would I filter?
Posted by Justin at 5/3/2006 9:35:40 AM
I have a column that uses nvarchar(50). Of course it contains both unicode and standard ascii character. Now if the data contains unicode, I want to see it in. Can you do this with single select statement? How would I filter out rows that does not contain unicode in that column? Thanks ...more >>

Using a trigger for Veritical Partitioning with a calculated table name...
Posted by William Holmes at 5/3/2006 9:34:29 AM
Hello, I have an application that requires table partitioning. I have no control over the query that is sent to the SQL server. I want to send the data to individual tables depending on the day of the month. What I have setup is one master table. On the master table I have configured an Ins...more >>

Group by and Case Statements
Posted by Red2 at 5/3/2006 9:25:44 AM
Hi, I have a query where I am using a case statement and a group by e.g. Select Field1, Field2, Field3, Max(Field4), CASE WHEN <something> THEN ' ' WHEN <something> THEN 1 END as Field4 WHERE <something> GROUP BY Field1, Field2, Field3, Field4 T...more >>

Using EXEC in a WHERE clause of a SELECT statement
Posted by agschwantes NO[at]SPAM gmail.com at 5/3/2006 9:17:29 AM
Is it possible to do something like: Select field1 from table1 where [ID] = (exec sp1 '1234567') I've never seen the exec used in this fashion and I've tried to find a direct answer to the question, thanks for any info and I apologize if this is a dumb question that requires a dumb answer ...more >>

Returning two values from Case statement
Posted by VMI at 5/3/2006 9:09:02 AM
I want to write a query that looks something like this. I get an error running this: select id_1 = case [ID] WHEN 1 then 'test' , 'test2' -- error end from myTable where id = 1 That way, I don't have to run the same query twice. I'll then insert those two values in another table...more >>

SQL 2005 Editor
Posted by Panos Stavroulis. at 5/3/2006 9:01:02 AM
Hi, I am quite new to SQL 2005. I've just loaded a file called .sp within the Management studio and I can't get it to connect to a database. If I change the file ext to .sql then no probs it works. I've tried to set an option in the options Window in Management Studio where you can add ...more >>

Opendatasource
Posted by bhorwitz at 5/3/2006 8:34:02 AM
I was able to use the following select qry with an OpenDataSource, but I recieve and error when I change it to an Update qry. SELECT * FROM OPENDATASOURCE( 'Microsoft.Jet.OLEDB.4.0', 'Data Source="\\Posiden\apps\Access\MsData\holdbk.mdb"; User ID=Admin;Password=' )...[HoldOrderDetai...more >>

Archive Strategy
Posted by Craig HB at 5/3/2006 7:27:03 AM
In our Inventory Control database we have tables that grow and grow and grow as the database gets used. Tables like StockResults, Deliveries, StockCount etc. I want to archive the data into archive tables, which I can later moved to another database, or even another server. This way I'll ha...more >>

Line item query
Posted by CJEN at 5/3/2006 7:12:39 AM
I have a query that I am trying to write that will get demographic information from one table and then get journal entries from another table. However, I want all the journal entries to be concatenated together so in the end I only have one record for each person. Any ideas? Thanks!! ...more >>

user defined function question?
Posted by nick at 5/3/2006 6:33:07 AM
for example: create function f(c int, ...) returns table @ret (....) as begin ..... set @v = select max(m) from B .... return end select * from a cross apply f(a.c, ...) Will the SQL statement "select max(m) from B" be executed 1000000 times if table a has a million rows? ...more >>

How do I get count to issue a 0???
Posted by sunshinevaldes NO[at]SPAM yahoo.com at 5/3/2006 6:17:30 AM
Hello all and thank you for your time. Table 1: Johnny BallTypeId= 1 Debbie BallTypeId= 2 Kurt BallTypeId=1 Table 2: 1 Baseballs 2 Footballs 3 Golf Balls Desired Output: Baseballs 2 Footballs 1 Golf Balls 0 NULL 23 SQL: select...more >>

Small Stored Procedure Help
Posted by manmit.walia NO[at]SPAM gmail.com at 5/3/2006 5:26:17 AM
Hello All, I am stuck on a particular Stored Procedure. Basically I am trying to fill a asp.net dropdownlist from a DataSet. The DataSet is being filled from my Stored Procedure. What I want to do is retrieve 4 columns from my table but 'CONCAT' 3 columns and use those as the DropDownList Text ...more >>

a query that doesnt work
Posted by Bardanca at 5/3/2006 4:24:53 AM
Hi, im programming to a Database over Access2000, and i had done this query: SELECT Sum(Importe) As SumaDia FROM [Diario Caja] WHERE Fecha between #03/05/2006 10:57:45# and #03/05/2006 12:57:45# the answer is null, but if i use a query like that SELECT Sum(Importe) As SumaDia FROM [Diario ...more >>

CS1595: 'Sanghi.Global' is defined in multiple
Posted by Mahesh at 5/3/2006 3:47:12 AM
hi when i try to run my c#.net web application i m getting following error if any one know the solution pls let me know Compiler Error Message: *CS1595: 'Sanghi.Global' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NETFiles\s...more >>

Poor query performance with: set statistics time on (SQL2K5)
Posted by Leila at 5/3/2006 3:39:17 AM
Hi, I try this query: ---------------------- use AdventureWorks go select c.*,o.* from sales.salesorderheader o join sales.customer c on o.customerid=c.customerid go set statistics time on go -- try the query again select c.*,o.* from sales.salesorderheader o join sales.customer c on o.c...more >>

control-m and sql25k
Posted by Enric at 5/3/2006 2:44:02 AM
Hi everyone, Does anyone know if control-m environment is be able to get in touch with SSIS packages? Thanks in advance, ...more >>

CRL return table function using dataadapter
Posted by Alphonse at 5/3/2006 2:37:30 AM
Hi, can we use dataadapter in CLR TVF? I try this code, but it failed with errors in sql when exec the function [Microsoft.SqlServer.Server.SqlFunction (FillRowMethodName = "Fill", DataAccess = DataAccessKind.None, SystemDataAccess = SystemDataAccessKind.Read)] public...more >>

Inserting data
Posted by Macca at 5/3/2006 2:30:02 AM
Hi, I have a table, Alert, that is made up of three entries as shown belowwhich come from other tables. Table Alert ------------- RoomID - (int)PK. This a foreign key from room table EventTypeID - (int)PK. This is foreighn key from EventType table RegionID - ...more >>

T-SQL- comparing NULLs
Posted by champ.supernova NO[at]SPAM gmail.com at 5/3/2006 2:25:22 AM
hope this is the correct forum for this question, guys. I'm using the following statement in a DDQ query to compare two values (asterisks obviously are normally 'real' values)- SELECT ID FROM tblEmployees WHERE NINumber = **** AND TitleRefno <> ? this works fine, except that the value I'm co...more >>

How to loop through a recordset in an SP
Posted by Mark at 5/3/2006 2:19:12 AM
Hi - could anyone please give me guidance, samples, for how to write a stored procedure, which will run a select statement, to get all records where a reminder date (remdate field) is today, and send an email to the (usr_email) account from the selected records? I can write the select statement...more >>

SSIS and DTS
Posted by Enric at 5/3/2006 12:03:01 AM
Dear all, I am looking for any way to launch SSIS packages through a job. How do I such thing? Something very alike when we ran Sql2k: DTSRun /~Z0xB2A214993E843 And at the same time be able to load them by Visual Basic: objdts.LoadFromSQLServer server, login, Password, , , , , strN...more >>

String comparison
Posted by simonZ at 5/3/2006 12:00:00 AM
I have column with data: "A,B" ID column1 -------------- 1 A,B 2 B,C 3 A 4 D 5 B,C 6 C,D Now, I have variable: declare @test varchar(20) SET @test='A,B' Now, I would like to get all rows from table where any of letter in column1 ...more >>

Insert or update depending on existence of record
Posted by Denise at 5/3/2006 12:00:00 AM
Hello I'm using SQL Server 2000, Windows 2000. I'm writing a SP to check for the existence of records in a table, and to insert or update based on this existence. In other words, I have 2 tables - source and destination. If a record from the source table already exists in the destination ...more >>

Count and top
Posted by simonZ at 5/3/2006 12:00:00 AM
I have complicated select statement which returns a lot of rows. I would like to show only top 50 rows on client, but also notice the client with the number of all rows of his search statement, like Showing top 50 of 1000 rows. How can I get count of all rows, something like: SELECT to...more >>

(a,b) not in ( select c,d from ... ) , is it possible ?
Posted by Hasan O. at 5/3/2006 12:00:00 AM

PIcture values for a column
Posted by Robert Bravery at 5/3/2006 12:00:00 AM
HI all, Is there any way to represent picture values for a column. SO that when viewing the data is presented slightly diferently than stored. Phone numbers for example might be (011)654-123654. But we would'nt wnat to store ()-, only 011654123654, but when view we would like to view it as above...more >>

Combining XQuery and data paging in SQL Server 2005
Posted by Marc Scheuner at 5/3/2006 12:00:00 AM
Folks, I have a table in SQL Server 2005 that contains a row of type "XML" (for now untyped - no schema behind it). I can easily query that table and retrieve values from the XML - way cool! I can also easily query that table and use the data paging mechanism based on the ROW_NUMBER() fun...more >>


DevelopmentNow Blog