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 thursday may 4

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

bl
Posted by Rakesh at 5/4/2006 10:56:02 PM
Need to Bulk Insert from a txt file: *************************************** Problem Description - There are special characters present in the file. For e.g., Montréal, Côte-de-Liesse… through Bulk Insert, they are getting saved in SQL Server as Montr+¬al, C+¦te-de-Liesse… --------...more >>


how to join two SELECT result and multiple one column?
Posted by guoqi zheng at 5/4/2006 8:39:03 PM
I have two SELECT query, say that both return results of column A, B, C. I would like to union the search results. However I would like to merge them and multiple C column. Supposed that I have two results of A B C 4 Vitamin 56 4 Vitamin 34 I would like to me...more >>

Charindex to not include the delimeter question
Posted by needin4mation NO[at]SPAM gmail.com at 5/4/2006 7:23:46 PM
Hi, I have this: select left (mycategory, CHARINDEX( ':', mycategory) - 1) as Cat from allCats If I have a column that has no ':' colon in it I get an error about invalid string. As long as there actually is a delimeter then all is well. But there isn't always a delimeter in the column va...more >>

System.Data.Sql.SqlDataSourceEnumerator visible servers???
Posted by newscorrespondent NO[at]SPAM charter.net at 5/4/2006 7:21:08 PM
System.Data.Sql.SqlDataSourceEnumerator is documented to return all visible SQL servers with several notes that it may not show all of them. Should this show all the servers that are shown in the SQL Server Manager connect dialog when I browse for servers? I have a small test server with SQ...more >>

Client Network Utility in 2005
Posted by scott at 5/4/2006 7:14:30 PM
Where can I find the "Client Network Utility" in SQL 2005? ...more >>

T-SQL help
Posted by Sam C at 5/4/2006 7:13:36 PM
Hi, Please help me with this T-SQL. I have mentioned my requirement towards the end. Thanks in advance! --DDL & DML use pubs go create table U_empl ( emp_id int identity(1,1) primary key, emp_name varchar(50) ) go create table U_tbl ( tbl_id int identity(1,1) primary key, tbl_nam...more >>

How to write 'update' statement to update top "n" records using Sql server 2000?
Posted by ABC at 5/4/2006 6:44:53 PM
How to write 'update' statement to update top "n" records using Sql server 2000? "n" is unknown and inputted by user. ...more >>

Same DB, same SP, differente results !
Posted by Junior at 5/4/2006 5:26:01 PM
Hi guys. I've got this weird behaviour in a SQL Server 2000 simple SP (see below). The very same SP in the same database brings records normally when I'm debugging a .NET app with DAAB 3.0 in my notebook, but as soon as I run the compiled application in another machine it returns with no recor...more >>



Insert Statement
Posted by Derek Hart at 5/4/2006 4:36:33 PM
I have an insert statement with 2 tables, such as: Insert tForm Select * From tForm2 I know that tForm has all the fields in tForm2, but tForm2 may have some additional fields not in tForm. The insert statement will not work because the same # of columns do not exist in both tables. Is t...more >>

CLR Defined Types
Posted by Sean at 5/4/2006 4:36:01 PM
All read up and ready to create a database project only to find we dont have "database" as an option for a project type. Any clues why? we have SQL 2005 running as well as running SQL reporting services. Thanks...more >>

Distinct on only one column, return all columns
Posted by randy1200 at 5/4/2006 4:08:02 PM
I have a table with many columns. I want to return all columns, and I want only the first record for each distinct value in the salutation column. I come up with the following: select c1.* from complainer as c1 join (select distinct salutation from complainer) as c2 on c1.complainerid = c...more >>

UPDATETEXT with Transactional Replication
Posted by Yan at 5/4/2006 4:06:57 PM
Hi, The bellow Update works fine but does not replicate and this is because it is treated as a single transaction regardless the fact that an explicit transaction is being opened inside the cursor. I need each UPDATETEXT statment to be a single transaction, any idea? FETCH NEXT FROM a...more >>

Eliminate duplicates from only one column
Posted by randy1200 at 5/4/2006 4:00:01 PM
-- Randy...more >>

Sql Code generation tools
Posted by helpful sql at 5/4/2006 3:07:47 PM
Hi all, Are there any good Sql code generation tools out there in the market? If not can you please give me tips or sample code for creating one? I need to automate code generation for data integration. Here is what I repeatedly need to do... We have a table called CONTSUPP in our Sql...more >>

Files corrupt when retrieving BLOB data
Posted by Paul Pleasant at 5/4/2006 2:57:01 PM
I am attempting (for the last several days) to save binary files to a SQL Server 2005 database and then retrieve the files later. Have tried the new varbinary(max) and image data types and several different techniques with no luck. I can save 'most' file types and get something useful (will op...more >>

@@servername returns NULL
Posted by Yan at 5/4/2006 2:53:02 PM
Hi, sql server 2000 sp3a select @@servername returns null but select * from sysservers shows the correct servername. This causes problems to set up replication. Any idea how to resolve apart of reinstalling? Thanks Yan ...more >>

strange occurances when add '1' to character string
Posted by rengeek33 at 5/4/2006 2:34:02 PM
I have a stored procedure that takes a text field and breaks it into 80 character chunks and stores it in a table for reporting as individual records. (client requirement). All was going well, into we noticed that the CR/LF were not working properly. To do this I changed my code that was r...more >>

Not able to open Query Analyser...
Posted by Shahul at 5/4/2006 2:28:57 PM
hi pals, Iam not able to open the Query Analyser in my machine. When I am clicking the QueryAnalyser, isqlw.exe is present in the Process Tab of TaskManager, but it is not running in the Machine. Any idea? @ Shahul. ...more >>

Extrapolate the size of filegroups by 12, 24 ,and 36 months.
Posted by Naana via SQLMonster.com at 5/4/2006 1:57:54 PM
Hi All, I have a large Database with two filegroups and I'm trying to extraplate the size of the filegroups for 12,24,and 36 months. I don't have historic data, but have current data as of Feb, Mar, & Apr. The days of these months are not the same( Feb-28days, Mar-31days, Apr-30days) and the d...more >>

What's wrong in my Select Statment
Posted by Islamegy® at 5/4/2006 1:45:45 PM
I'm try to run this procedure to implement Custom paging so i pass 2 paramters @PageIndex, @PageSize so if i @PageSize = 5 and PageIndex =2 (0 based index) then i want to ignore first 10 Rows right?? I wrote the following select statment: SELECT TOP 5 * FROM EVENTS WHERE NOT EXISTS ( SELE...more >>

What's wrong in my Select Statment
Posted by Islamegy® at 5/4/2006 1:45:12 PM
I'm try to run this procedure to implement Custom paging so i pass 2 paramters @PageIndex, @PageSize so if i @PageSize = 5 and PageIndex =2 (0 based index) then i want to ignore first 10 Rows right?? I wrote the following select statment: SELECT TOP 5 * FROM EVENTS WHERE NOT EXISTS ( SEL...more >>

optimized name-address-zipcode-region design
Posted by hazz at 5/4/2006 1:23:02 PM
Whether thin-client with round-trip cycles to the db or a rich-client loading look-up data into memory on application startup, what is a solid optimized database design for customer location search functionality. USPS zip data has about 75K records. Any articles on this? Thanks. -Greg ...more >>

Getting Records not in both tables
Posted by Irvin McCoy at 5/4/2006 12:24:02 PM
I have 2 tables and I want to retrieve all record that are in table 1, but not in table 2. Here's my data. Table 1: EstEquipment Columns: EstEqpPK, EstimatePK, Description Table 2: CrewEquipment Columns: CrewEqpPK, EstEqpPK, quantity I need all records in EstEquipment with a certain Est...more >>

Using max function
Posted by Roy Goldhammer at 5/4/2006 11:59:33 AM
Hello there I have table1 with Fld1, fld2, fld3. Fld1 is Identity and the unique primary key clustered. Fld2 and fld3 are indexed and don't unique. I need to build fast query that returns from table1 all the records with fld2 and fld3 unique and fld1 is the last enter. For this i us...more >>

Small exists problem
Posted by Lasse Edsvik at 5/4/2006 11:40:16 AM
Hello I'm trying to get this to work, i dont get the exists/join thing to work at all.... CREATE TABLE #Threads ( MsgID int, RootMsgID int, Foo char(1) ) CREATE TABLE #Test ( MsgID int, UserID int ) INSERT INTO #Threads(MsgID,RootMsgID,Foo)VALUES(1,1,'A') I...more >>

Active Directory, Terminated Employees
Posted by Pancho at 5/4/2006 11:22:01 AM
Hello, we have scheduled a nightly refresh into an Employees table in a database, that receives data from Active Directory. AD is the "authority" of who is an active employee and frees us from manual maintenance of the Employees table in our DB. However, we want to store information on emp...more >>

Cursor in stored procedure
Posted by Steph at 5/4/2006 11:15:16 AM
I'm trying to do something like that: CREATE PROCEDURE [dbo].[Test_Proc] (@SearchText1 nvarchar(10), @SearchText2 nvarchar(100), @SearchText3 nvarchar(100)) AS DECLARE @SQLString NVARCHAR(4000) DECLARE @SQLSelect NVARCHAR(3000) DECLARE @SQLWhere NVARCHAR(1000) SET @SQLSelect = 'SELECT ...more >>

Date & Time formatting to sort by date and time.
Posted by Mike at 5/4/2006 11:01:01 AM
Hi, I have a Startdate and StartTime in my table, I would like to combine to the 2 columns as one column so that it can be sorted as date. startDate - smalldatetime startTime - nvarchar ( I cannot change this) my current query: select StartsAt As convert(varchar, StartDate,111)+case when ...more >>

Way to check logged in by week HELP!!!
Posted by KT at 5/4/2006 10:34:28 AM
In need of a way to check whether or not a person logged in every day within a week (week starts Monday through Sunday). Does anyone know of a good way to accomplish this? In the table below, User #2 did log in each day within the week. I would need to check every week in this manner. ...more >>

detecting Update Conflict
Posted by Tanweer at 5/4/2006 9:22:02 AM
When a user try to update the record I use timestamp field (upsize_ts) to figure out if data was modified by other user. However I found out @@DBTS may cause problem in Multi user senario and may not return correct Tiemstamp value as it is not the timestamp for the current operation but for...more >>

Returning long string in varchar using Coalesce()
Posted by Ashish at 5/4/2006 9:16:01 AM
Hi, I want to return a string of words separated by comma using coalesce() so that the client application can look for a specific word in this long string.Following is the script:- CREATE TABLE WordList ( WordId int IDENTITY, WordDesc varchar(100) ) INSERT INTO WordList VALUES ('L...more >>

how to compare rows from oldtbl to curtbl using Like?
Posted by Rich at 5/4/2006 9:14:02 AM
oldtbl contains these CoNames 'abc' 'def' 'ghi' 'jkl' curtbl contains these CoNames 'abc inc' 'def inc' 'jkl inc' Note that curtbl does not contain 'ghi inc' I need to retrieve rows from oldtbl where CoName Like CoName in curtbl select CoName from oldTbl where CoName like '%' + cu...more >>

Restrict certain characters in varchar column
Posted by hals_left at 5/4/2006 8:22:49 AM
Hi - Is it possible to restrict the domain of a varchar column to prevent certain chatracters being accepted. I want to prevent commas. Thanks ...more >>

Getting Most Recent Date for Many IDs
Posted by mgabig NO[at]SPAM gmail.com at 5/4/2006 8:06:58 AM
Hello, Like the subject says, I'm trying to get the most recend End Date for multiple customer IDs in a table. The table, Rate, has multiple customer IDs and each ID may have multiple data in the endDate column. What I am attempting to do is isolate the most recent endDate for each ID and am ...more >>

Table Joins on more than one field
Posted by adi at 5/4/2006 8:04:41 AM
Hello all, Can someone help me with this SQL? 1) EMPLOYEE table has columns 'employee_id' and 'emp_sid' and other columns 2) EMPLOYEE_BENEFITS table has a column called employee_entity, this column can be joined to either 'employee_id' OR 'emp_sid' but not both in the EMPLOYEE table. ...more >>

Update Statement
Posted by marcmc at 5/4/2006 7:28:01 AM
If you run the followingDDL you will see my issue. CREATE TABLE FAt_bse_events_marc( dim_one_id int, dim_two_id int, ev_event_id int, ev_type_id tinyint, cur_trn_dt smalldatetime, f_ev_date smalldatetime, f_ev_count tinyint, f_ev_num1 float ) ...more >>

charindex faster than like operator??
Posted by Omnibuzz at 5/4/2006 7:12:01 AM
Hi ppl, While I was working on the post "compare 2 strings" in my test db, I came across this. I ran these queries, the ones using the charindex and patindex were faster than the like operator. I ran it in different tables with different inputs. But same result. I know server configs can ...more >>

hello
Posted by m00nm0nkey at 5/4/2006 7:09:15 AM
i've been alone with you inside my mind, and in my dreams i've improved performance a thousand times, i sometimes see you in the server room, Hello.... can you query your tables? I can see it in your transactions, i can see it in your logs, you're all i've ever wanted, you're the subject of ...more >>

UHG... Dates in SQL
Posted by SteveInBeloit at 5/4/2006 6:36:02 AM
Hello, I am having trouble searching on dates in SQL. I have a table that has a transaction date on it, type datetime. The user types in two dates, and the sql is supposed to return all transactions between those dates. So I say WHERE TranDate >= @FromDt AND TranDate <= @ToDt I'm thinkin...more >>

Problem using "AS" to add 2 numbers
Posted by friedman30 NO[at]SPAM gmail.com at 5/4/2006 6:18:44 AM
i need to add 2 results from a query to get this string: 2.2006 (that represents the number of the week, and the year) i have a table that holds these 2 columns ("week" , "year") as integers (i can't change it to string) i want to return them as one result, but when i do this: SELECT we...more >>

Using EXEC
Posted by Stephen K. Miyasato at 5/4/2006 6:08:25 AM
I'm a newbie still learning to use stored procedures. I have the following stored procedure @PatNo int, @Type int, @ABN int, -- abnormal values only 0 false 1, true. @Range int AS DECLARE @TempVS varchar(20), @table Varchar(20), @PatNo int, @Type int, @Range in...more >>

compare 2 strings
Posted by henk at 5/4/2006 5:27:02 AM
i have a Company table . one of the column is EmailAdres. now i want to compare a string(a emaiadres) agains this column. the problem is that the string is different every time. e.g. search Parameter1.: "test user"<testuser@yahoo.com> search Parameter2.: <testuser@yahoo.com> search Paramet...more >>

Multipart Identifier???
Posted by Phill at 5/4/2006 5:02:01 AM
I am getting an error: Multi-part identifier Ad.IPCode could not be bound. What does that mean? This is my query: SELECT Ad.ObjectID, ObjectTypeCode FROM dbo.ClassifiedAd Ad, dbo.Objects O JOIN dbo.CommunityProfile CP ON Ad.IPCode = CP.IPCode AND CP.StatusCode = 1 ...more >>

Using a DB name as a variable
Posted by Simon at 5/4/2006 3:54:02 AM
I am scripting database views to allow us to easily build a new server. However I would like to be able to have a variable containing the DB name that allows me to script views that look at other databases. something like DECLARE @div char(20); SET @div = 'DBName'; go CREATE VIEW view...more >>

How to make the database execute query faster PLEASE HELP
Posted by Fairy239 at 5/4/2006 2:52:01 AM
i got a very big problem help i need my database to execute one query in less than a min but it executes for 8 mins is there any way i can shorten the period of time execution? this is the codei am excuting some of the tables have 1-3gb big in size SELECT DISTINCT OmimVarLocusIdSNP.snp_id,G...more >>

How to make the database execute query faster?
Posted by Fairy239 at 5/4/2006 2:34:02 AM
i got a very big problem help i need my database to execute one query in less than a min but it executes for 8 mins is there any way i can shorten the period of time execution?...more >>

Find in SPs option for SQL
Posted by Will at 5/4/2006 2:33:39 AM
Hi All, Just a quick question, is there any option to search in all stored procedures in a database for a particular string, without scripting out the whole lot? Thanks Will ...more >>

Database mirroring
Posted by Craig HB at 5/4/2006 1:28:01 AM
I have a database that I want to split up so that I separate the transactional side from the reporting side. It seems that database mirroring (or something similiar) is what I should do. So I'll a have Transaction database that mirrors with a Reporting database. They both have the same dat...more >>

Loading DLL in SQL 2005
Posted by Woo at 5/4/2006 1:05:02 AM
I am trying to register a dll in SQL 2005. I am running the following: EXEC sys.sp_addextendedproc 'XP_FILE', 'XP_FILE.dll' After doing this the extended stored procedure appears in the master database but I cant use it. I then ran this, as per the Books online: DBCC xp_file (FREE) A...more >>


DevelopmentNow Blog