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 > july 2003 > threads for wednesday july 16

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

UDF problem
Posted by Tkim at 7/16/2003 11:59:10 PM
Hello ! I made a function that calculates percentile and returns decimal But one slight problem is that it's not dynamic and I want the function to some how look at every row of employee id and return values for every row of employeeID Thank you TKim select distinct employeeid, dbo.o...more >>


Query Required
Posted by Satish at 7/16/2003 11:15:44 PM
I have posted the same question, but since it did not appear in the thread, I am reposting it. Hello All, Thanks for your previous query feedback, I wanted one more help of such kind SkillValue_ID EmployeeNo SkillType ------------- --------------- ----------- 3 ...more >>

Query Required
Posted by Satish at 7/16/2003 11:00:11 PM
Hello All, Thanks for your previous query feedback, I wanted one more help of such kind SkillValue_ID EmployeeNo SkillType ------------- --------------- ----------- 3 C_0014 3 6 C_0014 1 9 C_0014 2 1 Q...more >>

Problems when inserting data into a table
Posted by Dino M. Buljubasic at 7/16/2003 10:39:13 PM
I am developing an application that stores various data into an SQL table. The problem I have is that all inserts seam to work properly. However, when I rightclick the table in SQL's Enterprise Manager and choose Open Table/Return All Rows, some of records currently inserted do not show. Ho...more >>

Procedure returns first EXEC not last?
Posted by Alexander Risøy at 7/16/2003 9:54:22 PM
Hi, I want to create a procedure that checks whether a server is updated or not. I compare a number on the client with a number on the server - the one with the smallest number is not updated. Here is some code from my procedure: ------------------------------------------------------------ ...more >>

Help with complex query
Posted by mmahony NO[at]SPAM rfood.com at 7/16/2003 7:19:05 PM
I am trying to write a query that will return the following information sorted by region: Region description Total orders for the period selected Total "ASAP" orders for the region Total "NON-ASAP" orders for the region Orders with quote time <= 50 minutes for the region Orders with quote t...more >>

Sorting VarChar in ascending order
Posted by Phoebe. at 7/16/2003 6:34:22 PM
Hi, Good Day! In my SQL database, I define my ClientCode as varchar. For eg: A12, 3456, 987, B19 I faced problem in sorting those records in order. Wrong sorting: 3456, 987, A12, B19 Correct sorting: 987, 3456, A12, B19 What shd i write to convert only those varchar that are in numbers so ...more >>

showing numbers after the decimal point....
Posted by Post Mortem at 7/16/2003 6:29:11 PM
Hi all..... what function or special way is there to determine how many numbers i want to show after a decimal point? For instance i want to use this format ###.## i saw ppl writing about a function?! called DECIMAL....but my SQL doesnt recognize that....and format doesnt work too..... all i ...more >>



easy question.
Posted by Mike at 7/16/2003 5:55:30 PM
how do I do that? Convert 2003-07-14 13:54:58.000 TO 07/14/03 1:54PM ...more >>

merge two table
Posted by Carlo at 7/16/2003 5:42:19 PM
hi i need to merge two table ... without duplicates, and i need to prefer the rows of thhe first table. If there is the row with the id =1 in the first table i dont add the row of the second table with id 1 Thanks a lot i'm beginner with sql Carlo ...more >>

Sql Profiler .
Posted by sri at 7/16/2003 5:38:11 PM
Did any one know how to capture locks information in Sql Profiler . I have selected in events tab locks and data Column tab I set it to default. And I have created blocking and dead locks in the database. When I saw in profiler I am not getting any usefull info. I am getting just Lock:Rele...more >>

GROUP BY challenge...
Posted by rooster575 at 7/16/2003 5:30:52 PM
I am trying to group by a range of values. For example. OrdersTable: {ClientID,DayOfWeek,Amount} 1,MONDAY,10 1,FRIDAY,12 1,SATURDAY,18 2,MONDAY,10 QUERY: SELECT SUM(Amount) FROM OrdersTable GROUP BY ClientID,DayOfWeek The problem is, I would like to combine Monday through Friday in the...more >>

In or Exists for my view
Posted by Bill Mittenzwey at 7/16/2003 5:22:45 PM
I have a view then when I query it like this: select Address.id as AddrId, ClmId FROM dbo.Address INNER JOIN dbo.Entity on Address.id = Entity.Address JOIN dbo.viewClaimsEntity on Entity.id = viewClaimsEntity.EntityId WHERE ClmId in ( 1 ) I get a very prompt result (<1s) But if I do this ...more >>

Problem with adding data to a table
Posted by Dino M. Buljubasic at 7/16/2003 5:13:29 PM
I am having an interesting problem when adding data to a table. My application gathers all kind of information and then stores the data in a table. No exception is thrown, everythng seams to be working well but when I do Open Table -> Return All Rows, SOMETIMES the added row is not displayed ...more >>

accessing results of xp_cmdshell in a stored procedure
Posted by axel strumberg at 7/16/2003 5:07:21 PM
hello, ich have to check in a stored procedure ,what databasefilesof a special name pattern are located in the Data directory (but they are not attached!) i get the results in the Query Analyser like this : Declare @DBDirectory varchar(500) Declare @execute varchar(500) set @execute=' ...more >>

quarter increase
Posted by Mike at 7/16/2003 4:14:35 PM
Hi, I want to do the followings, --------------------------------------------- @current_quarter + function(1) @current_quarter + function(2) @current_quarter + function(3) @current_quarter + function(4) let say I have @current_quarter = 3 by adding function(1) will go next 1 quarter, ...more >>

[SQL-DMO]Code execution exception: EXCEPTION_ACCESS_VIOLATION
Posted by Richard Wittmann at 7/16/2003 3:43:13 PM
I have SQLServer 2000 SP2 I am getting this error when trying to restore a database. The percent says 100% complete but I get this error. Thank you for any help! Rich Here is the code: Dim oServer As SQLDMO.SQLServer Dim Files() As String Dim FileCount As Long Dim ...more >>

Please help me muse: synchronizing DB and filesystem
Posted by Ken Fine at 7/16/2003 3:41:05 PM
I'm trying to come up with an effective way to manage many image files, and metadata about those images. My photographer clients tend to like to write images directly to a filesystem on a network share, rather than dealing with the kludge of working through a web application. What would be nic...more >>

insert nonprintable/formating characters into table
Posted by Igor G at 7/16/2003 2:54:06 PM
I need insert formated text (exs. FullName with Bold formated fonts) from one db.tablename.narrative (type text) to another db.tblname.Nerrative(type text). I tried to use only statement like: Insert into TableName ( col1, col2, Narrative,..) values ( 1, 'AAA', FormattedTextFRom Source Table,...more >>

ado recordfetch roundtrips ?
Posted by Ashish Sharma at 7/16/2003 2:08:37 PM
hi All, I was wondering if anyone could point me to some articles or material which details how and when exactly does ado recordsets make roundtrips to server to fetch records, also one of the discussions we had was that whether in all conditions ado recordcount property will fetch the corr...more >>

Simple Syntax Continued
Posted by Justin Dutoit at 7/16/2003 1:13:57 PM
Hey, thanks to Dan and Falik so far. I noticed after doing ALTER TABLE Products ADD CONSTRAINT DF_Products_Price DEFAULT (0) FOR Price that the price column was no longer required. I think NOT NULL should be in there somewhere but :) as a newbie I'm not sure what the t-sql should lo...more >>

Spellcheck in SQL Server
Posted by Kameron at 7/16/2003 1:11:58 PM
Hi All - I have a user that does heavy data entry in some large fields in our Database. Is there any way to integrate a spell check utility into SQL Server? Any spellcheck at any level. Thanks in Advance, Kameron...more >>

TSQL Query
Posted by Rayan Yellina at 7/16/2003 1:06:24 PM
Hi Friends, I am looping the below query 100,000 times because I am unable to write a 'SET BASED' query. Can any one help me out to write simple set based query. Thank you in advance. ----- WHILE (@Event_ID < 100000) BEGIN SET @execSQL = ' IF EXISTS ( SELECT * FROM GFDM.Event WHERE Ev...more >>

why I couldn't get the same order of retrieved records as inserting them?
Posted by Rabbit63 at 7/16/2003 12:50:54 PM
Hi, I have a table with 2 fields (firstname lastname and companyname), but no key. I am using SQL Server 7. If I insert 2 records one by one from an ASP script. I inserted "John", "Mortem" and "AJ company" firstly and then "Lisa", "Wang" and "AJ company". And then I try to retrieve the tw...more >>

How to convert bit to varchar
Posted by Student at 7/16/2003 12:29:40 PM
I need convert 0 to 'No',1 to 'Yes' . Is there anyway except function 'Case'. In my view design if i use 'Case', the diagram cannot show up. ...more >>

SP Resultset
Posted by Kevin Munro at 7/16/2003 12:28:14 PM
Hi, I've got a stored procedure that accepts one input parameter and returns a resultset. How can I view the resultset in Query Analyser? Thanks, Kevin. ...more >>

Find string inside stored procedure
Posted by Tim at 7/16/2003 12:28:12 PM
I have several stored procedures inside of a database. Is there any way to search them and find which procedures contain a particular string/value. I have to change a hard coded value inside several procedures and I need a quick way to find which procedures contain the specific value. ...more >>

Storing Select result set into a variable ??
Posted by Rick at 7/16/2003 12:27:14 PM
Is it possible to assign the result set of a Select statement into a variable, eg. if my result set is abc def ghi can i store this one column into a variable of type varchar (8000) ?? OR is there any other way to do this, the reason is I have a comment record in a table and I want to...more >>

verifing whether a table with same name exist or not before creating new table
Posted by akash sinha at 7/16/2003 12:15:32 PM
hi verifing whether a table with same name exist or not before creating new table using asp i hope to get asw soon akash...more >>

xp_sendmail
Posted by Ross Culver at 7/16/2003 12:02:38 PM
My @subject doesn't show up as the subject of the email. Is there a trick to something so simple? EXEC xp_sendmail @recipients = 'robertk;laurac', @message = 'The master database is full.', @copy_recipients = 'anned;michaels', @subject = 'Master Database Status' Thanks ...more >>

SELECT statement
Posted by Simon at 7/16/2003 11:52:46 AM
I have 2 tables, user and country AND I would like to SELECT all users from the country of current user (up_id=1): userTable ------------ up_ID up_country_ID up_name up_address ........ CountryTable: ----------------- country_ID country_Name select up_name from userTable WHERE u...more >>

Money amount shows as "1,23" instead of "1.23"
Posted by Justin Dutoit at 7/16/2003 11:25:44 AM
I don't know if this is a SQL Server issue or ADO.NET, but here goes- I have a sql server table with a Price column. The prices are in the format "1.23", but (this uses an ADO.NET datareader) it's being read as "1,23" which causes a problem.Is this a setting in SQL Server? Tks Justin Dutoit ...more >>

concatenating in xp_sendmail @message
Posted by borr at 7/16/2003 11:23:01 AM
Hi, I'm sending an email with xp_sendmail and trying to use this concatenate a variable to text, e.g.... "@message='Hello, please repond to '++ @Rep." @Rep is my variable (like you didn't know that), and it should read "Hello, please resond to Microsoft". But I get this error "Incorrec...more >>

Using VB Script to email....
Posted by Brett at 7/16/2003 11:18:27 AM
Hello, I am attmepting to use VB Script to send email from a job step. Does anyone have a VB Script that sends out email from a job? I do not want to use xp_sendmail... I want to use VB Script. I am running Windows 2000 Server and SQL Server 2000. Please advise... Thank you, B...more >>

information_schema
Posted by Chuck at 7/16/2003 11:14:05 AM
Hi, can someone tell me how to drop a table using the information_schema.tables view. Thanks Chuck ...more >>

SQL Programming Class
Posted by harbir at 7/16/2003 11:08:08 AM
All, First, thanks for all help that you have provided me for all my postings. Which class would be helpful to take if I wanted to get good at SQL Programming, espcially Triggers and Stored Procedures? I took Programming a SQL Server 2000 Database but my instructor didn't really go i...more >>

Comparison on two tables?
Posted by Chai at 7/16/2003 10:57:00 AM
Hello: I need help on writing a query that will compare data between two tables (that have the same columns & data types). We just need to compare the data in each column between those two tables. There are about 50 columns. I am thinking about doing "Where" clause to compare each column but ...more >>

Using functions in Query Analyzer - escape character?
Posted by Chris Ashley at 7/16/2003 10:56:05 AM
How do I use a function in query analyzer in a 'where' string clause? Is there an escape character? EG: If I wanted to do something like...WHERE FieldName LIKE '% Left(SomeField, 1) %' Thanks, Chris ...more >>

Extract & Move Zips
Posted by Steve at 7/16/2003 10:53:43 AM
All, I have a DTS that periodically checks for new Zip files in a particular directory. If they are present it extracts them. However, I now want to move the Zip's after they are extracted. I use an Activex task to do the looping and extracting and I originally though that I could just a...more >>

Testing SQL Server 2000 on Performance
Posted by news at 7/16/2003 10:47:02 AM
Hi ! Is there any idea how to test SQL Server 2000 on Performance with SP3 instaled and without it ? Is there any tools which do this ? Thx ...more >>

CASE in UPDATE?
Posted by betski at 7/16/2003 10:10:25 AM
Hi, i want to update my Customer table in my SQLServer database. I want to check whether each field in the table has a value assigned to it - if it does, i want to check whether the new value (the one that the user wants to put in the field) is null/0 or not. If it is null/0, i want to keep ...more >>

How detect SQL7 busy???
Posted by lubiel at 7/16/2003 10:02:52 AM
Hello, Someone knows the way to detect in SQL Server 7 when it is overload, this is, how many process existing running, and so on. I have this problem, from my asp page I run a stored procedure, but sometimes my server SQL7 is overload or have many process running there for instance job...more >>

Can't Delete from a Table
Posted by Steve at 7/16/2003 9:58:13 AM
I'm using VB.Net programming and I have a Function built that takes the name of a stored procedure and two variables. These are sent to SQL 7.0 in order to delete, update or insert records in my tables. I am using this same process on two other tables and it works very well but for some r...more >>

column default to fiscal year
Posted by Sue B. at 7/16/2003 9:57:32 AM
Hello, I would like a table column to default to the fiscal year based on current date. If datepart(month,getdate()) > 6 then FiscalYear = datepart (year,getdate()) else FiscalYear = datepart(year,getdate ()) + 1. In other words, fiscal year 2004 begins July 1, 2003. What is the ...more >>

Locking questions ...
Posted by Bob Castleman at 7/16/2003 9:56:22 AM
My understanding was that if the isolation level on a connection was READ COMMITED that a select statement would request locks with mode shared. But when I run a simple select * from the query analyzer, the locks generated are intent-share and intent-exclusive. These intent-exclusive locks seem t...more >>

Check For Indexes
Posted by Steve at 7/16/2003 9:21:34 AM
Hi All, I have a DTS package that takes a considerable length of time to run. I've managed to get the time down to around three hours by adding a number of indexes to the various tables. This is fine. However, the tables are re-created each week, without indexes. I have no control over t...more >>

Exec procedure and date parameters
Posted by Emmanuel at 7/16/2003 9:19:32 AM
How can I successfully pass a date parameter to an exec procedure? I have the following code. declare @tablename nvarchar(30) declare @d_startDateTime datetime declare @d_endDateTime datetime set @d_endDateTime = dbo.f_GetDateTime(getdate (),'143059') --cutoff date and time set @d_startDa...more >>

Best Way to Replace COM?
Posted by Steve Harclerode at 7/16/2003 9:13:46 AM
Hi, I need to create a trigger on a table to run another process that will take the new row and process/filter it, and then transport it to various other destinations (using ftp, etc). Writing the trigger is pretty easy, but I'm wondering, what is now considered to be the "best" way to interfa...more >>

Count two distinct items in a table.
Posted by davlondon NO[at]SPAM yahoo.com at 7/16/2003 9:13:37 AM
I have a table with roughly the following values: (each restarant will have such a table) MenuItem Vegetarian ======== ========== Fish & Chips NO Beans YES Cake YES Beef NO Corn YES Steak ...more >>

Concantonated Keys
Posted by Simon at 7/16/2003 9:13:27 AM
Please can any one help? I have two tables a Header and a Detail Table. The header table has a PK called Forecast_No This has a foreign key relationship with a concantonated primary key in the Detail table consisting of the Forecast_No and a Forecast_Line_No. For instane Header.Fore...more >>

About resultset paging
Posted by w. jORDAN at 7/16/2003 9:12:58 AM
It is known to all of us that there isn't any one-step paging SQL statement in SQL Server. On the net, I found several solutions for resultset paging with TSQL. 1. Select ordered records into a temp table which has an indentity column (id), and then Select between id>a and id<...more >>

Using column number inplace of column name in SQL Select statement
Posted by ssharda NO[at]SPAM invlink.com at 7/16/2003 8:31:15 AM
Hello All, Is there a way to run sql select statements with column numbers in place of column names in SQLServer. Current SQL ==> select AddressId,Name,City from Address Is this possible ==> select 1,2,5 from Address Thanks in Advance, -Sandeep...more >>

bigint Joins
Posted by Obi Wan at 7/16/2003 8:18:18 AM
I've got the following update: update a set extractortypeid = b.extractortypeid , co2valveid = b.co2valveid , bottomsealtypeid = b.bottomsealtypeid, containerno = b.containerno , necktypeid = b.necktypeid from dbo.CONTAINER a...more >>

output params
Posted by JT at 7/16/2003 8:15:36 AM
what is the correct way to call a procedure specifying output parameters?? like this: EXEC sp_CreateGLDetail @err_code = @err_code OUTPUT, @err_desc = @err_desc OUTPUT, @err_sql = @err_sql OUTPUT or: EXEC sp_CreateGLDetail @err_code OUTPUT, @err_desc OUTPUT, @err_sql OUTPUT or do th...more >>

Capturing Table Modifications
Posted by Peter at 7/16/2003 8:04:25 AM
Dear All, I am in a development environment with 8 developers all of which have rights to make structure changes. As they can be an undisplined lot (we have tight deadlines) sometimes they make structure changes to the db without telling me. Is there a way then other than denying them...more >>

Trim
Posted by Anne Too at 7/16/2003 7:49:47 AM
hie, i am transfering some queries from access to sql server views. in access, there is one line of coding that i am not sure how to transfer it into sql server. The microsoft access coding goes like this: Trim([IFSAPP_MMR].WO_NO]) how can achieve the same effect in sql server? thanx! ...more >>

Dynamically set the column name for IF UPDATE ( column ) in trigger
Posted by Jay at 7/16/2003 7:44:17 AM
Sql Server 2000 Update Trigger Question Is there any way to dynamically set the column name when using the [ { IF UPDATE ( column ) ] trigger conditional statement. I have tried creating the statement as a string and executing it and that did not work. example: {set @sql = 'If upda...more >>

Execute a dts package from asp
Posted by DRE at 7/16/2003 6:51:10 AM
I am trying to execute a stored procedure from an asp page that executes a dts package and the results from the error object reads: "xpsql.cpp: Error 997 from GetProxyAccount on line 472" Is there a better way to execute the dts package from the asp page? thanks in advance....more >>

Error: no primary or candidate keys in the referenced table
Posted by books1999 NO[at]SPAM hotmail.com at 7/16/2003 6:44:39 AM
Can someone please explain me the error that I get when i run the DDl in the query analyzer. I Created the db schema using Visio Enterprise architect. HServer: Msg 1776, Level 16, State 1, Line 3 There are no primary or candidate keys in the referenced table 'MerchandiseOrders' that match the...more >>

xp_cmdShell 'dir s:\backup' Access Denied
Posted by JDP NO[at]SPAM Work at 7/16/2003 6:16:19 AM
Any assistance w/xp_cmdShell would be appreciated. I'm reluctant to start changing any logins before I have a better understanding of what login/element to change. I'm getting Access Denied when I'm trying test running a simple DIR command. S:\ is a mapped drive on another MSSQL Server. I'...more >>

Creation of primary key
Posted by Anand at 7/16/2003 5:45:57 AM
Hello, I am going to create new tables for a database. Wanted to know whether creation of IDENTITY Column and setting it as a primary key is good OR Creation of column with Datatype UniqueID and setting a default with NEWID() and then setting the column as Primary key is good. Wh...more >>

Getting the Columns comma separated
Posted by babuganesh2000 NO[at]SPAM yahoo.com at 7/16/2003 5:01:23 AM
I have many table with more than 250 columns. I have to dynamically generate script to build the column names in the select statement. Due to the varchar(8000) limit half of the column names are getting truncated. What is the best of doing it. My sample script: Declare @tableNames table (id...more >>

SELECT fieldnames FROM table
Posted by Len at 7/16/2003 4:36:22 AM
Hi there. Does anyone know how I can retrieve the names of the fields in a table with only the table name? I'm looking for a recordset of field names returned from something like "SELECT fieldnames FROM table" Any help would be appreciated, Len....more >>

Adding non exsisting rows in a view.
Posted by jim.holmes NO[at]SPAM devro-casings.com at 7/16/2003 4:06:28 AM
HI, I'm currently working on a view to display production information, the view is broken down over a 24 hour period, displaying each production line, what it manufactured etc. The view is over a table which contains data on every item produced and is grouped by hour. This works fine provid...more >>

Select data from linked server
Posted by Bent Lund at 7/16/2003 2:28:36 AM
Hi, i just set up a Linked Server in Enterprise Manager, and wonder how can I select data from a table in the database? The linked server I named MES, the database is LV2 and the table is "MyTable". How do I select all records from MyTable ? Regards, Bent *** Sent via Dev...more >>


DevelopmentNow Blog