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 > march 2005 > threads for wednesday march 30
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
Need to Improve
Posted by TargetBleigh at 3/30/2005 11:44:50 PM
I need to improve my supposedly considerable SQL query skills.
A change in management has forced me to re-interview for my own position,
and now I am in a hurry to develop the skills that I had exaggerated on my
Job Description Form 22b1993-a.
I would like a *free* set of online Queries, al... more >>
Dynamic SQL is faster.
Posted by Yitzak at 3/30/2005 11:16:37 PM
Hi I have a stored proc -
takes a long time to execute so re-compilation isn't an issue.
I pass a comma separated varchar param to the stored procedure.
exec sp_somename @CSV = '1,2,3'
If I build the SQL statement in the SP and then execute the statement
dynamically:
EXEC ('SELECT * ... more >>
I know this is not the right newsgroup but...
Posted by Alex Potter at 3/30/2005 10:45:38 PM
Hi there,
I am wondering (since they share a common parent) if sybase supports the
same kind of automation Interface (SQLDMO) as SQLServer???
TIA
... more >>
Date conversion.
Posted by Arul at 3/30/2005 6:31:03 PM
Is there a function I can use to retrieve the month and year of say getdate()?... more >>
BCP in stored procedure
Posted by Bari Allen at 3/30/2005 4:55:57 PM
I have a stored procedure, which loops through a database and runs a BCP
statement (with changing criteria), as follows:
exec master..xp_cmdshell 'bcp "SELECT myfields FROM Database..Viewname WHERE
criteria ORDER BY criteria" queryout "C:\File.txt" -S ServerName -T -c'
When I run this, I get... more >>
Adapting data from one format to another
Posted by Melissa Whalen at 3/30/2005 4:50:05 PM
Hi,
I have some data that I've received in a particular format and I need to
change it to fit my table format. I've attached .CSV file samples of the
format that I've received and the format that I need it converted to. I'm
trying to write T-SQL (with limited experience) to do it because I h... more >>
Sample code
Posted by S Shulman at 3/30/2005 4:43:32 PM
Hi
I am looking for sample code that changes the password of an existing user
Thank you,
Shmuel Shulman
... more >>
skip error
Posted by Nikhil Patel at 3/30/2005 4:42:00 PM
Hi all,
I have a stored procedure that builds a dynamic query and executes it
using EXEC statement. Sometimes when the syntex of the query is wrong, the
procedure generates the error. In that case I would like Sql Server to
continue executing the procedure from the next statement and do not ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Clear the transaction log
Posted by Jon Glazer at 3/30/2005 4:30:35 PM
Can someone tell me the procedure the clear out the transaction log so it
doesn't crash my server again in the future?
Thanks!
Jon
... more >>
Decimal value
Posted by simon at 3/30/2005 4:27:01 PM
When I use cast:
cast(100*T1.value1/T1.value2 as decimal(18,2))
I always get dot for decimal point, for example 10.2
Is it possible to get comma for decimal point, for example 10,2
Thank you,
Simon... more >>
finding sql server code page
Posted by Ajey at 3/30/2005 4:05:25 PM
Hi,
Using DMO i can find the SQL Server code page. Is there a stored
procedure or any systable where I can get the same without using DMO.
Thanks.
Ajey
... more >>
Reliabily retreiving accurate stored procedure definitions
Posted by Mark Heimonen at 3/30/2005 3:58:40 PM
Backstory:
We run an environment with almost thirty similarly structured, constantly
evolving databases, hosted on both development and production servers. We
have recently begun a process of versioning these databases, with an attempt
to streamline the process of upgrading individual data... more >>
sp in a view
Posted by Larry Storrm at 3/30/2005 3:32:22 PM
I would like to union the results of
msdb..sp_help_job for a number of servers
in a view.
I can create a UDF which returns a table,
but I can't use "exec msdb..sp_help_job" in the insert
statement.
suggestions?
NOTE: sqlserver2000 sp2 on all db servers... more >>
decimal question
Posted by TJBowens at 3/30/2005 3:05:30 PM
I am working on a bcp table dump. I have a column that has a numeric value
with 2 decimals. Is there to have the result file show no decimals if there
is no value in this table. Right now, it looks like
123.45
0.00
123.45
0.00
I would like it to look like :
123.45
0
123.45
0
... more >>
Controlling Trigger actions based on user
Posted by KBryan at 3/30/2005 3:01:05 PM
Is it possible to control the actions of a trigger based on the user who
updates the record?
In pseudo code, I'm trying to do the following:
on update:
if (updating user = "User_A") and (Artist_Type = "DJ" or "CL") then
{ newrecord.PIC_FIELD = oldrecord.PIC_FIELD }
Could someone... more >>
Help in creating xsd file
Posted by mvp at 3/30/2005 2:55:01 PM
Hello everybody,
I have following XML and i do want to create xsd file to BulkLoad data
into SQL SERVER table, so pls help me how can i create xsd file out of
following XML file....
<PTLV_PROJ>
<PROJECT>
<PID>10649280</PID>
<PDESC>FS2 - TAX MEETINGS GENERAL</PDESC>
<ACTIVITIES>... more >>
unwanted EM messages
Posted by bagman3rd at 3/30/2005 2:49:03 PM
Would someone PLEASE tell me how to terminate the annoying EM messages stating:
"There has been no recent activity in the Results pane, ..."
I am sick of my computer beeping at me every minute or so until I click the
"yes" button.
Thanks
Archer... more >>
Listing jobs that ran last hour
Posted by Brett Davis at 3/30/2005 2:36:29 PM
Hello...
I want to write a query that will list for me the name, date and time of
jobs that ran from the previous hour. I am using SQL Server 2000.
Thank you,
Brett
... more >>
comparison on text field
Posted by Leonard Poon at 3/30/2005 2:25:31 PM
my query: select * from inventory where ModelRef=' '
but, the result includes all records that having blanked ModelRef field.
I want to know what setting controls this behavior.
Thanks,
Leonard
... more >>
DTS
Posted by Johnny at 3/30/2005 2:25:06 PM
What is the easiest way to give a user the abilitiy to run a DTS package
without having the Enterprise Manager on their workstation?... more >>
What sequence?
Posted by Fabri at 3/30/2005 2:00:48 PM
I guess in which order, to get best performance, do I have to exec these
steps:
1) Defragment Disk FileSystem on which the MDF and LDF files are.(they
are all in the same disk)
2) Shrink databases
3) dbreindex tables
Any help much appreciated.
Best regards.
--
Fabri
(Non è tuttu... more >>
UPDATE statement using information from same table and other tables
Posted by Chris at 3/30/2005 1:37:48 PM
Hi,
I am having trouble producing an UPDATE statement using information from the
same table and other tables...
I created this query to return all the items that I would like to update in
a table called TourDeparturePickupGroupPickupPoints....
SELECT dbo.PickupGroupPickupTimes.Picku... more >>
find right database for stored procedure
Posted by Random at 3/30/2005 1:33:47 PM
I have a message queueing system set up so that applications can insert
message information into a database using a stored procedure in the master
database...
CREATE PROCEDURE sp_PutInQueue
<...message parameters...>
AS
DECLARE @dbid smallint
--get the database context who is runni... more >>
inner join update based on sum
Posted by JT at 3/30/2005 1:09:25 PM
can someone please show me how to correctly write this query for sql server
2000 - thanks much!
UPDATE myTableA
SET myTableA.Field1 = sum(myTableB.FieldToSum)
INNER JOIN myTableB on myTableA.id = myTableB.id
WHERE myTableB.FieldDescID = 41
sql server is complaining that i cannot have an ag... more >>
Exporting Diagram
Posted by DMP at 3/30/2005 12:36:18 PM
Hi,
How can i export diagram from one database to another database ?
... more >>
Reasons to use BETWEEN
Posted by Fernando Ponte at 3/30/2005 12:27:02 PM
Hi all.
I searching for information about the use of BETWEEN or ">=" and "<=".
Which solution is better and how SQL Server manages queries using these
expressions?
Any link, white paper or information will be usefull to me.
Thanks in advance.
--
Fernando Ponte
... more >>
What is Cardinality
Posted by Rizyak at 3/30/2005 12:21:40 PM
-----Cross posted on comp.databases.ms-sqlserver and
microsoft.public.sqlserver.programming-----
Can someone please explain cardinality to me? I am having a problem with an
insert from a webpage.
When a user adds a venue with an event I need both tables to populate.
Currently only the ev... more >>
bulk insert (again and again..)
Posted by Vince
Hi !
sorry to bother you again with that topic..but...
Bulk Insert inserts null value when it finds null string in my source
file to load...
is there any way to prevent this??
I would like to get null fields instead of NULL value in my base..
thanks again :)
++
Vince... more >>
_wcsupr () with german characters
Posted by Ajey at 3/30/2005 11:45:04 AM
Hi,
I have a string which contains some german characters e.g 'Menü'. I
am converting it to upper case using wcsupr (). But ü is not converted to Ü.
There are other characters too. I can use the _wsetlocale () function before
using _wcsupr (). I cannot use the current machines locale sett... more >>
backup database
Posted by Jason at 3/30/2005 11:23:37 AM
Hi,
I tried to the following but i'm getting an error near '.' Can someone tell
me if this is correct?
Here is my syntax to backup a database from another location:
BACKUP DATABASE [192.168.160.20].Mydatabase TO DISK =
N'\\BACKUPSERVER\Backup\Mydatabase.bak'
... more >>
Problem with left join
Posted by Aleks at 3/30/2005 11:05:48 AM
Hi,
I have a query that is supposed to return records and make a left join where
one field is not null, but for some reason is not working properly and
returns the records even though they are null.
----------
SELECT *
FROM cases a
left join activities as w on a.id = w.caseid AND w.... more >>
Prob with Case in Crosstab Query
Posted by Ron at 3/30/2005 11:00:53 AM
Greetings,
The following crosstab/pivot query is not working.
create table tbl2(
col1 varchar(10),
col2 varchar(10),
col3 char(1)
)
Insert Into tbl2 Values('dbo', 'area1', 'A')
Insert Into tbl2 Values('dbo', 'area1', 'B')
Insert Into tbl2 Values('dbo', 'area1', 'C')
Insert Into tbl2 ... more >>
Problem with query
Posted by Aleks at 3/30/2005 10:58:18 AM
Hi,
I have a query that is supposed to return records and make a left join where
one field is not null, but for some reason is not working properly and
returns the records even though they are null.
----------
SELECT *
FROM cases a
left join activities as w on a.id = w.caseid AND ... more >>
Identity Column Rollover
Posted by John Manion at 3/30/2005 10:55:02 AM
If I have an Identity column defined as a smallint
seed=1, increment=1
Does it automatically roll back to 1 when the number of records reaches
32,767. Assuming of course, the last record assigned identity 1 has been
removed.
I assume it does, but hey, I've assumed stuff like this before ... more >>
alter column statement doesn't work, trying to change datatype
Posted by Cory Harrison at 3/30/2005 10:48:10 AM
I'm trying to do something like this:
ALTER TABLE [tablename] ALTER COLUMN [fieldID] int;
I've tried several versions of this, and the data type is never changed from
numeric. I have removed all indexes on the table and it still doesn't work,
no error messages or anything. I am trying to... more >>
Need help with SQL statement
Posted by David at 3/30/2005 10:37:02 AM
Hi all,
I'm having trouble coming up with the correct MS SQL statement to do the
following operation.
I have two tables:
Participants (p_id, p_fname, p_lname)
Participants_Keywords (pk_p_id, pk_keyword)
I want to write a query that matches participants based on the keywords they
s... more >>
Using inline aggregates - is this possible?
Posted by Jami Bradley at 3/30/2005 10:35:36 AM
I have been seeing a high CPU load on one of our SPs and the main cause of it is a function to find
the minimum date of 3 dates. The SP updates 3 date columns and also needs to store the earliest of
the 3 in another column.
When I use a function to return the minimum date, it works, but it for... more >>
Moving changes from test server to production server?
Posted by epigram at 3/30/2005 10:20:24 AM
We're starting out some development efforts here at work (with SQL Server
2000) and I'd like to know where I can find some best practices regarding
migrating changes from your test sql server to your production server. The
basic iteration as I see it is:
1) Create initial database on produ... more >>
Optimize SQL
Posted by Bruno N at 3/30/2005 9:54:28 AM
Hello All!
Is there a way to write this SQL without a UNION, because where i have to
set one field to null to match the number of field of the second sql :(
SELECT ('Caixa' + ' - ' + Nome) AS Nome, Caixa.CaixaID AS ID, NULL AS
AgenciaID, 'Caixa' AS Tipo
FROM Caixa
UNION
SELE... more >>
Selecting sub hirearcy
Posted by Allan Ebdrup at 3/30/2005 9:35:11 AM
I have a self-referencing table, with a parent child relation
(parentDepartment)
How do I select a table of a single department and all it's children and
grand children and their children etc. using TSQL?
I'm guessing I need some sort of recursive function?
... more >>
List user-defined objects
Posted by dw at 3/30/2005 9:21:58 AM
Hi, all. How does one list all the user-defined objects (tables, udf's,
udt's, stored procedures, and views) for a SQL Server 2000 db -- the ones
owned by dbo? Thanks.
... more >>
Help creating a DELETE trigger.
Posted by John Piotrowski at 3/30/2005 9:21:02 AM
I need to create a trigger that will run whenever a record is deleted. I
want the trigger to delete records from table2 where the value in the ID
field matches the value in the ID field of the record being deleted from
table1.
I'm new to triggers and am not sure how to set this up.
Tha... more >>
Trim Characters
Posted by JoeM at 3/30/2005 9:15:02 AM
I need some assistance...
I have a column of numbers, in varchar format (I made a mistake, should have
defined as numeric) but to further compound the problem, users have entered
amounts, in this field, for example:
123
123.00
123.12
12345
12345.
123456.77
.... etc
What I Would ... more >>
Insert <NULL> via Enterprise Manager
Posted by epigram at 3/30/2005 9:13:17 AM
I am experimenting with a table in the Tables view. I chose to Open Table |
Return Top from the right-click menu and made an edit to a row's field. It
was previously <NULL> and I want to set it back to its default value. How
can I do this within this view? If I can't, how can I do this wit... more >>
performance issue regarding views/correlated subqueries
Posted by Tyson Kamp at 3/30/2005 9:09:03 AM
Hi,
I'm seeing something that I don't understand and really need to know
"why". I have a view (call it V_1) that is generated by a statement
containing a correlated subquery. Assume a table T_1 that has 3 columns: two
ints (say C1 and C2) and a smalldatetime (say C3). The sql to create V... more >>
select "subset" of data?
Posted by epigram at 3/30/2005 7:47:17 AM
I'd like to know if there is a way to select a subset of rows from what
would otherwise be the entire result set. I know you can build a query with
"select top x", where x is the number of rows you would like returned from
the top of the result set. I'd like to be able to produce a select
... more >>
FOR/NEXT/LOOP structure??
Posted by The VanDerbeck Group at 3/30/2005 7:33:13 AM
I'm just getting up on SQL and I have a very basic issue. How would you
implement a "loop" or FOR/NEXT directive in SQL. I have looked around and do
not see anything that seems like a likely command. Thanks in advance for your
input.... more >>
unique clustered index on a partitioned view
Posted by KDA at 3/30/2005 6:19:49 AM
I'm trying to create a unique clustered index on a view, I
have set the proper SET options, used 2 part naming,
explicitly named the columns, the objects are owned by the
same owner (dbo), the objects are all in the same
database, the tables are all contain a unique clustered
index and a c... more >>
updating date field based on another field value
Posted by VMI at 3/30/2005 6:02:06 AM
I have a table that contains a date field called
trans_date and a string field called card_name.
Basically, what I need to do is check what card_name has.
If it has 'A', then I need to add 30 days to trans_date.
If it has 'M' or 'V', then I add 2 days. Once I add the
days, I need to check... more >>
Mismatch in result-sets between QueryAnalyser and ADO.Net DataSet
Posted by Sabari at 3/30/2005 4:35:05 AM
Hi,
I have a StoredProc (using Cursors) running on SQL Server 2000. I use
DataAdapters from ADO.Net (2K3) to fill the DataSet from a Win App. But the
number of records returned in each case do not match.
Further, the DataSet has different # of records when invoked from the
ADO.Net method... more >>
DATEADD
Posted by geert.defevere NO[at]SPAM roularta.be at 3/30/2005 4:26:27 AM
Hello,
Who can help me with this issue:
I've a database with a field "Value" that is of the data_type
nvarchar. There is also a field "Method" that has the value "DateTime"
if the content of the field "Value" has a date and time value in the
format "dd/mm/yyyy h:mm:ss".
If the record h... more >>
How pictures are stored in database ?
Posted by serge calderara at 3/30/2005 4:21:01 AM
Dear all,
one of my custoimer request is the possibility to import graphics inside a
database field, graphsics usually coming froma scan document or picture.
Format could be gif, jpeg, bmp etc..
First of all is it possible to do so with SQL server ?
If yes, how the graphics is stored i... more >>
ADO=CHAR, ADOX=VARCHAR?
Posted by CDE at 3/30/2005 3:29:15 AM
Using ADO's GetSchema method with SQL Server 2000
(provider = SQLOLEDB.1) to return a column's data type, my
VARCHAR column is returned as adChar. Getting the type via
ADOX gives me the correct value of adVarChar. I have my
workaround but is there any info on this e.g. known issue,
KB arti... more >>
a simple insert/update trigger
Posted by Scott at 3/30/2005 2:39:33 AM
Hi I am looking to create a simple trigger for both UPDATES and INSERTS
where any change to tbl1 will be inserted/updated in tbl2.
The insert works okay, with values added to both tables, however when I
perform an update, it seems to add an extra row in tbl2.
Here's the code:
CREATE TABLE [... more >>
DISTINCT not returning data in sorted order after specific no. of
Posted by Kesari at 3/30/2005 2:39:03 AM
Hi
I have the problem with the DISTINCT keyword. I used the following statement
to get the distinct values from the table:
SELECT DISTINCT trade_name FROM Customer
This works absolutely perfect getting the distinct values and getting in
sorted order. But my requirement needs the stateme... more >>
finding missing number
Posted by bijupg at 3/30/2005 1:57:21 AM
Hi Guys,
I am using sql server 2000 and i want to find missing
number between 1 and 1000 in a table.
what is the query for that?
pls advice me.
RGDS
Biju
... more >>
Function to return week number
Posted by mark NO[at]SPAM muddyboots.com at 3/30/2005 12:59:52 AM
Does anyone now how I can create a SQL function to return a week
number for any date with the following guidlines?
-Weeks begin on a Thursday and end on a Wednesday.
-1st January is always in week 1.
-Week 1 for this year would go from 30/12/2004 to 05/01/2005
I have been going round in circl... more >>
|