all groups > sql server programming > april 2005 > threads for monday april 11
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
Complex query. Can anyone solve this one
Posted by Apok at 4/11/2005 11:53:14 PM
Hi
A little complex one
What i really want is that my table contains duplicate
firstname,lastname and dob.
what I need to do is check the two fields datecreated and
datelastupdated and retain the latest record based on
date of these two columns and update the other records
with OLD.
... more >>
Find instances of sql running
Posted by Fatema at 4/11/2005 9:38:01 PM
Is it possible to do the following. If yes then how ?
- Is there a way to find out all the instances of the SQL server running ?
- Read the alerts generated by SQL server.
- Read the logs generated by SQL server.
Thanks,
-Fatema... more >>
Need a query to tell me how much of something was used
Posted by someone at 4/11/2005 8:57:38 PM
Well, I posted a week or so about a problem I had and someone was kind
enough to respond with help. I'm on my last hurdle for a report I'm doing.
I hope someone can help me out on this as well. First of all, before I go
any further, I hope someone can recommend a good book to help me learn h... more >>
Variable limiations in Yukon
Posted by Christian Perthen at 4/11/2005 8:14:57 PM
Hi,
Quick questions, what is the largest variable size supported in Yukon? Does
it support text variables?
Is the current varchar(8000) limit a thing of the past?
Thanks in advance
Christian
... more >>
SQL query question!
Posted by KH TAN at 4/11/2005 7:14:01 PM
Hi all,
Need some help on SQL query. I have a table like this:
location contact
---------- --------------------------------------------------
16 Edwin
16 James
28 Jason
28 Moses
36 Michael... more >>
Generating a personalised report for every vendor and mailing out the same
Posted by karenmiddleol NO[at]SPAM yahoo.com at 4/11/2005 6:47:45 PM
I have the following reporting scenario.
I have a table which contains a list of customers/vendors and each
record in this table as the customer/vendor number, name and email
address of the vendor and also the record as the value of the business
done by the vendor/customer for this month, year... more >>
ASP and SQL2000 drop-down menu
Posted by HollyylloH at 4/11/2005 6:44:01 PM
Okay, I am new to this so be gental.
I have a form with 2 drop down menus and a text field that I am concerned
with. Size, Packaging, and Cost. Size and Packaging pull their info from a
Size and a Packaging table respectively. I need the third field, Cost, to
take the values selected by the... more >>
placeholder for uniqueidentifier
Posted by at 4/11/2005 5:53:55 PM
Hi,
I need help with a SQL SELECT statement. I am using a UNION to merge four
tables together. For the tables that did not include a particular field, I
have used a placeholder of 'N/A' in the SELECT statement as follows:
SELECT organizationid, organization_name, businessunitid, ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Need help combining views; DDL included
Posted by Terri at 4/11/2005 5:23:39 PM
I've solved this issue by creating 3 views but I'd rather do it in 1 SELECT
if possible.
Given my data I want to select duplicate securities based on the cusip field
in the Securities table where the cusip does not exist in the Positions
table. To rephrase I want duplicate securities that are... more >>
select all dates in a range
Posted by JT at 4/11/2005 4:54:26 PM
how can i select all dates in a range, even if there are not records related
to these dates?
for example try,
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[myTable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[myTable]
GO
CREATE TABLE [dbo].[... more >>
Function Date
Posted by Daniel Caetano at 4/11/2005 3:50:11 PM
A have initial date 20/04/2005
and a final date 25/09/2005. i´d like a function that return how many days
there are for each month until the final date.
Ex: 04/2005 - 10 days
05/2005 - 31 days
_
_
09/2005 - 25 days.
Is that possible, or i have to create some ... more >>
Connection.Execute & SQL Stored Procedure
Posted by Simon McLaren at 4/11/2005 3:37:02 PM
I am hopeful that those of you with more experience in the compilation of
..asp, the connection object and MS SQL Server as the DB can help me out. I
have a web app that routinely calls stored procedures in a MS SQL DB.
In one web page, I make 6 calls with the Connection.Execute 'store
pro... more >>
Is there a trick to this (or am I missing something)?
Posted by Brad M. at 4/11/2005 3:29:56 PM
Hi Everyone,
Let me just start off by saying I appreciate any responses given to this
question. I've been trying to figure out a safe, simple way to do this, but
I fear I can accomplish only one of those :-) Below is DDL, and below that
is the problem I'm experiencing. Again, thanks in a... more >>
splitting incoming column data into output variables
Posted by hazz at 4/11/2005 3:16:02 PM
How do I convert the result of ;
select Vintage, Cases,SalesYear from viewSupply
order by Vintage,SFSalesyear
Vintage Cases SalesYear
----------- ----------- -----------
2003 228954 2005
2004 114477 2005
2004 237635 2006
2005 118817 ... more >>
Mysterious overhead when running a query
Posted by Uri Dor at 4/11/2005 2:42:50 PM
Hi,
I have an inline user-defined function which activates a chain of UDFs
and views which produce a modest result set (23 rows, 320 bytes per row).
When I run the UDF from query analyzer, the query executes consistently
in 5 seconds. If I try taking time on the server side by adding
getdate... more >>
Search a string from concated text
Posted by Magnus Blomberg at 4/11/2005 2:30:03 PM
Hello!
I have a table, Employees, with the cols FirstName and LastName.
I would like the user to be able to search for just the name.
For example the user could write 'Bob Dylan' in a textbox.
I want to do this with a single select code line. Something like:
SELECT * FROM Employees WHERE Fi... more >>
Parsing string and Inserting each element?
Posted by John Rugo at 4/11/2005 2:24:26 PM
Hi All,
I'll try and make this simple.
I have a column in a table that has one or more values separated by a comma.
Ex: 1234,456,322,33445,abce,ekksks
I want to go through each record and take this column data and parse it out,
then insert each element into another table.
ex:
IN... more >>
How to select the data by month....
Posted by Alan Ho at 4/11/2005 2:17:48 PM
E.g.
SELECT ID,
FROM staffactual
WHERE (DateTime= '2005/4/11') <--- Actually, i wanna get the April
not 2005/4/11
Thanks
... more >>
SQL Query examples site
Posted by Lara at 4/11/2005 2:12:12 PM
Hi,
Where can i find examples /qns of SQL queries.
i am preparing for some interviews
regards AR
... more >>
@@Error not trapping
Posted by JP at 4/11/2005 2:07:09 PM
Im having to convert dates for an mainframe file. 3/3/2005 to 03032005. So I
datepart each portion of the date and then add zeros when needed and string
it back together.
When trying to do some of the checks on the dates
set @Month=convert(varchar(2),DATEPART(month, @myDate))
if(@@ERROR=0... more >>
tricky select with "hierarchy of roles" (with DDL)
Posted by David J Rose at 4/11/2005 2:02:37 PM
If I have some "nested" SQL Server roles. eg.
sp_addrole 'Complete'
sp_addrole 'Department 1'
sp_addrole 'Department 2'
sp_addrole 'Department 2 managers only'
sp_addrole 'Department 3'
sp_addrolemember 'Complete', 'Department 1'
sp_addrolemember 'Complete', 'Department 2'
sp_addrolemember... more >>
Help with slow query please...
Posted by Griff at 4/11/2005 2:01:51 PM
I've inherited a piece of SQL that takes an age to run (it's dynamically
created, not in a stored procedure)
---------------------------------------
SELECT
DISTINCT tableA.fieldA,
tableA.fieldB
FROM
tableA
INNER JOIN... more >>
SUBSTRING Question
Posted by Brian at 4/11/2005 1:57:42 PM
Is there a T-SQL equivilent to VB's INSTR function?
I need to split one field into 2 fields based on the position of the space
character, for example if I have Col1 = 'Fred Bloggs' I want to make Col2 =
'Fred' and Col3 ='Bloggs'
Is there an easy way to do this without having to run through t... more >>
Query Question
Posted by tarheels4025 at 4/11/2005 1:35:01 PM
I have this query. Where would I place a state like
where len (card_acceptor_identification) = 4
that would pick the card acceptor identification = 4 in the store table not
the financial message table. Any help is appreciated. Thanks.
SELECT S.card_acceptor_identification, count(M.card_a... more >>
SARGability
Posted by Mike Labosh at 4/11/2005 1:02:41 PM
Where can I find a good discussion of this, with tips on making use of it?
--
Peace & happy computing,
Mike Labosh, MCSD
"Escriba coda ergo sum." -- vbSensei
... more >>
how should I script a table to have default values as well?
Posted by RayAll at 4/11/2005 12:57:09 PM
How should I script a table to have defualt values as well in the script?
Thanks
... more >>
Execute statement?
Posted by Thread77 at 4/11/2005 12:43:01 PM
Hi,
I have an ADO component in a delphi program that I use to check a database
for structure changes that are needed. This is basically just a long list of
SQL statements. In one instance I need to add a new field if it doesn't
exist, then update the field with values from another field. ... more >>
tricky select with "hierarchy of roles"
Posted by David J Rose at 4/11/2005 12:09:43 PM
If I have some "nested" SQL Server roles. eg.
>>Complete
>>>>Department 1
>>>>Department 2
>>>>>>Department 2 managers only
>>>>Department 3
where "department 1" is a member of "complete" and "Department 2 managers
only" is a member of "department 2" etc.
and I have a table using thes... more >>
Storing Time only
Posted by Elmo Watson at 4/11/2005 9:51:09 AM
I'm creating a calendar online and I'd like to have a field in my table
store ONLY the time sent to it (1:00PM, etc) - - however, when I set the
field for datetime, and send it a time, I always get 1/1/1900 stored with
it...
How do I get around this (or can I)?
... more >>
Does anyone use views?
Posted by Bruno N at 4/11/2005 9:50:04 AM
Good Morning,
Does anyone have any use for views? I know how to build them, but i cant
find any use for them.
They are supposed to protected the data, protect how? does the users have
access to all the data if i dont use views? should i allways access views
insted of the tables to protecte... more >>
When to use with encryption
Posted by Bruno N at 4/11/2005 9:31:59 AM
Hello, good morning all!
When should i use with encryption? Should i put it in all the views? Should
i use it with the stored procedures that the my clients are going to use?
Thanks you all very much!
Bruno N
... more >>
Verify SQL Agent is started
Posted by Ferde at 4/11/2005 9:00:02 AM
How can my application verify SQL Agent is running using transact
SQL(preferable) or sqldmo?
Thanks,
Ferde... more >>
error converting the char value BUT IT IS A CHAR ALREADY
Posted by Steve'o at 4/11/2005 8:48:01 AM
SQL Server 2000 SP3a
Access 2000 SP3 (using adp)
Im going mildly loopy, hopefully someone can aid my sanity.
Table in SQL Server had a column (column_a tinyint), data contained is just
ones and zeros. In Enterprise Manager I changed the data type of column_a to
char(1), so that I could t... more >>
Full-Text Index doesn't recognize alphabetic char's?
Posted by roy.anderson NO[at]SPAM gmail.com at 4/11/2005 8:16:12 AM
Hey all,
I have a Full-Text catalog on these 3 fields using the PK (a
uniqueidentifier)
as the index:
bookingnum nvarchar(18) NOT NULL
containernum nvarchar(8) NOT NULL
equipment nvarchar(50) NULL
The interesting thing here is that when I run a select query, it
doesn't recognize alphabet... more >>
simple date question
Posted by chris at 4/11/2005 8:09:13 AM
Hello.
Is there a function that pulls just the 'date' from the standard 'timedate'
format that includes the minutes and seconds?
Thank you!
Chris... more >>
Urgent Help for OLE DB provider linked server
Posted by Rodger at 4/11/2005 7:32:35 AM
here is a error message i am getting when i am firing a insert
statement
INSERT INTO #nfi_stage
SELECT *
FROM yrsprodwcom.yrs.dbo.nfi_stage_arch
WHERE INPUTDATE > @max_date_YRPARL order by id
Server: Msg 7391, Level 16, State 1, Procedure manual_YRS_nfi_update, Line 73
The operation co... more >>
Migration from Sybase to SQL 2000 problems
Posted by João Costa at 4/11/2005 6:43:04 AM
Hello,
I'm having a problem migrating a particular stored Procedure wich runs
nested and interdependent Fetching from temporary tables.
There is a main cursor and from that, a var is retrieved for use as a
parameter for other cursors. The most important is that the Cursor's queryes
all run... more >>
SQL Server Instance and Script (Query Analyzer)
Posted by Siu at 4/11/2005 6:43:04 AM
Hi,
I would like to add a script in a setup program (.msi), but I have a
problem: when I run the setup program, I get the following error:
"SQL Server doesn't exist or access is denied"
I know already what is the problem, namely the script doesn't have the
reference to the instance where ... more >>
Retrieve Data from SQL Server in an hierarchical XML.
Posted by JaRa at 4/11/2005 6:34:03 AM
Hi,
I have a table containing hierarchical data and I would like to retrieve it
form SQL Server as hierarchical XML so i can use it directly for binding with
e.g. the ASP.NET2 Treeview
E.g table:Nodes
Table:Nodes
id parent Name
1 0 Node1
2 1 Node11
3 1 Node12
4 2 Node111
Format ... more >>
trying to build the opposite of a select distinct query
Posted by jason at 4/11/2005 6:30:07 AM
considering the following example:
SELECT DISTINCT idcolumn, column1 FROM table1
might produce the following sample results:
idcolumn column1
-------- -------
1 apple
2 orange
3 kiwi
how might i query for ONLY the rows with DUPLICATE column1 values? to
prod... more >>
Decimal being rounded in Insert statement
Posted by Mark at 4/11/2005 5:50:46 AM
Hi - when I insert a decimal amount into my SQL Server 2000 database, it
rounds it up.
My table has a column:
customer_amount decimal 9
...and has Precision set at 18, and Scale set at 2.
I am grabbing the decimal value from a textbox on my form, and passing
it as a parameter in ASP.Net:... more >>
please help me to write a query
Posted by kamal hussain at 4/11/2005 5:14:43 AM
hello,
Dex helps me a lot till. thx to dex.
i m unable to write one more small query.
i Have a table like
CREATE TABLE T_CLASS_MT (CLASSID INT, SUBJECTS VARCHAR(1000))
and my data is
INSERT INTO T_CLASS_MT VALUES (1,'MATHS,PHYSICS,CHEMISTRY');
INSERT INTO T_CLASS_MT VAL... more >>
Problems adding % sign to a number
Posted by Chris Dunigan at 4/11/2005 4:54:45 AM
Hi,
I have a stored procedure which outputs a number as decimal(5,1). I
would like to add a % sign to the end of this number, however when I do
this using CAST(x as VARCHAR)+'%' I get the following error:
Microsoft OLE DB Provider for SQL Server error '80040e07'
Error converting data type v... more >>
How I post a message on MSMQ?
Posted by Salvador at 4/11/2005 4:49:01 AM
Hi,
I want to execute a T-SQL for adding a message on a message queue, I know
that I can create a DTS task but I want to include it on a trigger. I found
extended procedures like xp_createprivatequeue and so on but no procedure to
push a message, Also I know that I can create my own xp to d... more >>
Forcing size of a field
Posted by Filippo Bettinaglio at 4/11/2005 3:26:42 AM
Hi,
I have a field x varchar(6)
I want force the values at least at 4 char no less
how can i do it?
NULL must be still valid.
Thanks, Filippo... more >>
Get all databases in a SQL db
Posted by Fatema at 4/11/2005 3:06:03 AM
Is it possible to programmatically get a list of all the databases in a SQL
server db ?
TIA,
-Fatema... more >>
Website form input value from queried table
Posted by HollyylloH at 4/11/2005 2:23:05 AM
I have a web form (ASP not ASP.NET) that imputs into a sql2000 database. I
need to return a
value based on the values a user enters.
The user would choose a "size" and then choose a "packaging"
I have a table that has three columns "size" "packaging" and "cost"
I need to have the cost v... more >>
COALESCE(NULLIF(@intError, 0), @@ERROR)
Posted by E B via SQLMonster.com at 4/11/2005 12:00:00 AM
Anybody know if the COALESCE(NULLIF ...)...) can raise error itself, and if
it safely to use this combination of checking error status
Every time after i calling to some store procedure i use this:
------------------------------------------
DECLARE @intError int
EXEC @intError = myProce... more >>
Nest transactions in SQLServer
Posted by MaHahaXixi at 4/11/2005 12:00:00 AM
hi guys:
i am doing a hard work of migrating programs from Oracle to SQL-Server.
i encounte a problem about transaction which hardly hurt my heart (forgive
my poor english first ... :-) )
you know,there is such a usage in oracle:
SAVEPOINT xxx
doing things1....
doing things2...... more >>
natural order
Posted by aramid at 4/11/2005 12:00:00 AM
Hello everyone,
I got a select statement with a few joins, and without an ORDER BY,
that returns 5 rows always in a specific order, which was incidentally
the order in which the rows were inserted. When this same select
statement was made into a stored procedure, the output of the stored
pro... more >>
Help needed making a tidy join query
Posted by Matthew Speed at 4/11/2005 12:00:00 AM
(Simplfied for question asking purposes)
I have a help desk system with support categories and assignable
employees. I would like to run a query that will pull back a list of
all categories along with a count of unassigned tickets. So my tables
are:
tblSupportCategories
CategoryID int
Cat... more >>
Executing a stored procedure in Oracle from SQL Server
Posted by at 4/11/2005 12:00:00 AM
What's the easiest way to execute a stored procedure in an Oracle database
from SQL Server. Should I create a linked server to the Oracle database
first?
... more >>
|