all groups > sql server programming > june 2006 > threads for thursday june 15
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
Second try: Need a little help with a sql query
Posted by MatsL NO[at]SPAM newsgroups.nospam at 6/15/2006 11:22:07 PM
My post was, umm... lost or something. Didn't show up in my client
anyway. So I do a second post. Sorry if this is posted twice.
Here it is:
Hi, I hope this is the right group to ask this kind of question, but I
saw some other people asking for help with queries so here it goes.
I have ... more >>
Need help with a query
Posted by MatsL NO[at]SPAM newsgroups.nospam at 6/15/2006 11:10:26 PM
Hi, I hope this is the right group to ask this kind of question, but I
saw some other people asking for help with queries so here it goes.
I have a view created from two tables. One holding base data and the
other localized data. It looks something like this (simplified version)
BaseTable
... more >>
int 4 to 04
Posted by Magnus at 6/15/2006 9:03:14 PM
Hi!
Is it possible to write a select query to make a simple adding so that a
number always returns two digits?
If I write "select mynum from mynumbers" and mynum is 4, I want to return 04
as char(2).
If mynum is 12, I want to return 12 as char(2).
Regards Magnus
... more >>
pass string to stored procedure
Posted by Fabuloussites at 6/15/2006 8:21:01 PM
I have a table that has the follow format
PageID (integer)
Member_Id (varchar(20))
in my VB.net application, i have two strings that that take the following
format
Pages="2,2,3,4,4"
Members= "member1,member2,member3,member4,member5"
is there any way to pass the string variables to a ... more >>
Need to add date during bulk import from csv
Posted by BCS at 6/15/2006 7:28:16 PM
I'm downloading an weekly retailer statement from our state's website in csv
format so I can import it into a SQL database and then use the data for some
custom reports. I've been able to successfully write my first bcp command to
import the file into an existing SQL database. However, I just rea... more >>
Dynamic query in a function
Posted by Thomas Mick at 6/15/2006 6:55:26 PM
Greetings:
I am trying to write a view that includes a column derived from a function
call.
The function is written thus:
CREATE FUNCTION dbo.fnc_CapArrayValue
(@MEASUREMENTID INT,@TRACKINGID BIGINT,@JET INT)
RETURNS REAL
AS
BEGIN
Declare @Result REAL
SET @RESULT = (select ... more >>
Complex sql update
Posted by dmalhotr2001 NO[at]SPAM yahoo.com at 6/15/2006 5:41:08 PM
Hi,
I'm trying to update a key in tablea with tableb using the where there
are mulitple where criteria. I'm trying to avoid the sql cursors to do
update for each record.
Is there a way I can do that in the following statement:
update billing_detail_debit_card set bdp_id =
(
select b... more >>
Export data to linked servers (almost impossible) ?
Posted by Fabri at 6/15/2006 4:52:44 PM
(sorry for eventually double post but i don't see my post in some news
servers)
I'm using Sql server 2005 Express.
I linked a mysql server via MSDASQL.
All done.
I can read from MySql.
What about to write into MySql?
I can't do this stuff:
===================================... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Stored Proc Debug c0000005 Abend
Posted by MikeV06 at 6/15/2006 4:40:31 PM
MS SQL 2000/sp 4 Standard on Windows 2003 and Personal on Windows 2000.
Both bomb when trying to use the debugger.
For example, Use pubs, expand stored procedures, right click on one of the
user procs, select debug, and wait for the abend. Happens on both machines.
ODBC: Msg 0, Level 19, Sta... more >>
changing table design - interesting
Posted by VJ at 6/15/2006 4:37:31 PM
I have a table:
Product_id(parent_id), product_ref_id(child_id), product_name
2 0 clothes
3 2 pants
4 2 shirts
5 2 coats
6 3 jeans
8 6 ... more >>
grouping by a datetime column
Posted by prefect at 6/15/2006 4:24:21 PM
i want to group the records in a table by day , using a datetime column.
Therefore I have to get rid of the time of that column before grouping.
What is the proper way to do that?
thnks..
... more >>
Querying entire database
Posted by Willie Bodger at 6/15/2006 4:03:49 PM
So, is there any way that you know of that I can search for a specific
string in the entire database? I figure it's a longshot but it never hurts
to ask, right?
wb
... more >>
Row already belongs to another table.
Posted by Kevin Burton at 6/15/2006 3:53:01 PM
I have a DataGrid that uses a DataTable as a DataSource. Call this table dt.
The DataGrid is editable so changes will be flushed back to the DataSource
(dt). I want to keep track of the changes so I created a duplicate table
(call it dtCopy). To see the changes I simply check every column in e... more >>
Format numeric to display dollar value $1,000.00
Posted by slimla at 6/15/2006 3:25:02 PM
Hi,
Currently, I have a numeric field stored a value of 1000, how can I covert
it to varchar value and display it as $1,000.00
Thanks
... more >>
VS.NET: SQL Server Project
Posted by Ryan Hunt at 6/15/2006 3:20:49 PM
Trying to get warmed up on CLR... I have Visual Studio 2005 but I don't
have the "SQL
Server Project" available to me anyware when creating a new project.
Did I install something incorrectly? Is there a way for me to download
templates?
I should be using the "SQL Server Project" type to w... more >>
moving northwind
Posted by rodchar at 6/15/2006 2:28:01 PM
hey all,
what's the best way to move my northwind that's in msde and move it to sql
express 2005?
thanks,
rodchar... more >>
UTC string to DATETIME
Posted by dan artuso at 6/15/2006 2:12:58 PM
Hi all,
I have a column that contains a string (20060215072349.000000-300)
representing the uTC time. I need to convert this into local DATETIME type.
How is this done?
Thanks in advance!
--
Dan Artuso
... more >>
how to select
Posted by Dav Tan at 6/15/2006 12:58:43 PM
Hi,
I have a table like this, Type 'A' will always exists for one ID group,
other types might exist, might not.
ID Type Description
1 A xxxxx
1 C xxxxx
1 D xxxxxx
2 A xxxxxx
3 A xxxxxxx
3 ... more >>
Filtering out null results of subquery
Posted by Ney_André_de_Mello_Zunino at 6/15/2006 12:41:19 PM
Hello.
I am having trouble setting up a simple query. It is supposed to return
a summary of CD titles and their total time duration (the sum of all its
tracks' duration). The tracks hold a foreign key to the CD they belong
and have an optional duration attribute.
select
title,
(
... more >>
how to get sqlcmd return values
Posted by paul at 6/15/2006 12:16:02 PM
I'm having a hard time getting a non-zero return value from sqlcmd when a
error in the sql script it is executing occurs.
I've tried setting the -V parm to 10 and -m to 10 (although don't thing -m
is relevant) but regardless ERRORLEVEL is always 0
Here is a sample of the sqlcmd and the os ... more >>
executeBatch fails on stored proc call
Posted by StevenMartin at 6/15/2006 12:00:36 PM
I have a stored procedure that is only supposed to insert if the record
does not already exist.
ALTER PROCEDURE [CARTS].[Insert_Store_Item_Price_Data]
@Store_Item_Price_Change_ID varchar(50),
@Store_ID char(4),
@Item_ID char(14),
@Batch_Number_ID varchar(6),
@Effective_Start_Date datetime,
... more >>
sp_sqlagent_get_perf_counters
Posted by Mitch at 6/15/2006 11:21:01 AM
There are several demo alerts installed with SQL2000 that are enabled. I've
disabled them, but I still see the "sp_sqlagent_get_perf_counters" running on
my server. It is taking up alot of cpu. How do I get this thing to stop
running?
Thanks,
Mitch... more >>
How to Create Virtual Database
Posted by Mohamed Naseer at 6/15/2006 10:23:40 AM
Dear Friends,
in my company we have a product.it is developed on ASP and Sql server 2000.
all the sql are written in side the asp page.There so so many roles for
application user.the security checks are written inside the ASP page.
Ex: if user has right to access Division1 and Division2 insid... more >>
Using TOP
Posted by JT at 6/15/2006 10:23:29 AM
Hi,
I am trying to write a procedure that will return the most expensive Order
Detail for each Order in the Northwind database.
For example, Orders has a parent-child relationship to OrderDetails.
Presume that for each Order, OrderDetails contains one or more rows, each
with a price. Wit... more >>
Schema Discovery
Posted by minoad at 6/15/2006 9:33:46 AM
I have an old odbc complient database sitting on an AS400. I have a
connection to the database, however the comany is being less than
forthwright with thier database documentation. Is thier a way for me
to use a query or some other method to discover the Tables, fields,
stored procs ....
T... more >>
Aggregate Case Conditions
Posted by Rajeev at 6/15/2006 9:25:15 AM
I have a table AAA which contains two columns fileid and typecd
for single fileid there can be either 1, 2 or 3 typecds home, host and
payroll
for e.g.
Fileid Typecd
100 Home
100 host
105 home
106 host
106 payroll
107 ... more >>
Execution Plan of a CLR Stored Procedure?
Posted by C at 6/15/2006 9:11:10 AM
Hi,
Is it not possible to view the Execution Plan of a CLR Stored Procedure?
I have set (Ctrl + M) Include Actual Execution Plan.
Thanks,
Clive. ... more >>
How to view transactin log?
Posted by pelican at 6/15/2006 8:45:01 AM
Kind of remember when you turn on all system files, the transaction log wil
show up with all database files. How to bring all system files up?
In a database folder, you can view the file name, owner, type, and date
created. Is there a way to see the date last modified?
Thanks in advance.... more >>
Dateformat
Posted by Alur at 6/15/2006 8:35:01 AM
How can I determine current
SET DATEFORMAT ?... more >>
sql 2000 design/documentation tools
Posted by bringmewater NO[at]SPAM gmail.com at 6/15/2006 7:47:17 AM
What are some good tools I can get (free or buy) to be able to clearly
design and document databases in MS-SQL?
Thanks
... more >>
SQL statement syntax error..Please read
Posted by Khalid Rahaman at 6/15/2006 7:35:01 AM
I am trying to filter a recordset using the following SQL statement
SELECT * FROM 'cars.sold' where seller='" & txtSellername.text & "'"
the txtsellername.text refers to a texbox on a VB form which contains the
name i want to filter by.
This works great for everything except when the var... more >>
The Temp Table blues OR The Dynamic SQL blues
Posted by roy. NO[at]SPAM nderson NO[at]SPAM gm NO[at]SPAM il.com at 6/15/2006 7:05:02 AM
Hey all, I need some suggestions (if any) for improvement. If you think
I'm on the right track, let me know as well. :) Basically I'm a web dev
creating a page that will search through almost 5 million records, so
speed is important. The users will be able to search via 15 different
criteria. Du... more >>
Reset Automatic Numbering
Posted by Comm Port not Working at 6/15/2006 6:59:02 AM
Does anyone know how to reset the autmatic numbering in SQL?... more >>
Too many table names in the query
Posted by madhouse at 6/15/2006 6:59:02 AM
Hi
SQL2000
My requirement is to extract from a table that has 156 columns by n rows
such that each of the columns becomes a row in the data-set, ie n*156 rows
returned.
I'm doing this with a Union Query.
eg Select col1 from tble union Select col2 from tble....etc upto Col156
I then need to... more >>
Error 3271 while doing a backup
Posted by Rodger at 6/15/2006 6:32:02 AM
Hi I am trying to do a backup of a database and it gives me the following
error
Nonrecoverable I/O error occurred on file 'C:\Program Files\Websense
Reporter\wslogdb61.mdf'. [SQLSTATE 42000] (Error 3271)
I ran dbcc checkdb and it gives consistency errors on one of the table, i
dropped a... more >>
Transaction Log Question
Posted by S Chapman at 6/15/2006 6:27:42 AM
I have a program (Catastrophe Model) that inserts thousands of rows
into a database program during the course of single function. The
problem I am facing is that during the execution the log size becomes
huge( 10-12GB).
How can I clear/truncate the log file? BACKUP command does not seem to
... more >>
How to check the existence of a login with the SQL-DMO?
Posted by Oskar at 6/15/2006 5:15:02 AM
Hi,
I want to use the MS SQL Server 2000 SP3 SQL-DMO API to check if a specific
login exists in a SQL Server instance. However, having scrambled through the
SQL-DMO reference manual, I didn't find an elegant solution to this problem.
So I put up with a less elegant solution, which involves de... more >>
Unikey Keys Design Question
Posted by S Chapman at 6/15/2006 4:16:22 AM
I have many tables that have composite logical primary keys. I have
however created a single identity column in such tables and made it the
PK. Should I also be creating Unique Key Constraints on the logical
primary key columns? What is the overhead of creating unique key
constraints? Thanks... more >>
Inserting records into Postgres from SQL server 2k Using Openquery
Posted by Fuzzygoth NO[at]SPAM gmail.com at 6/15/2006 2:50:32 AM
Hello,
We have a set of tables in a MS SQL Server 2000, These tables are
updated via
PDA from external location using a sycronisation from a Win CE MS SQL
DB.
This is all fine, I have to create a trigger that will insert the
information from
SQL Server to Postgres. I done a bit of reading a... more >>
SQL query transform columns into rows
Posted by christophe.leroquais NO[at]SPAM gmail.com at 6/15/2006 2:32:52 AM
Hi,
I have a query which returns this:
NB NB_Int1 NB_Int2
11104
11108
11109 11109I1 11109I2
11111 11111I1 11111I2
11115
I want to transform it to get:
NB
11104
11108
11109
11109I1
11109I2
11111
11111I1
11111I2
11115
Do you how I can do that with SQL?... more >>
convert input parameter into field
Posted by joe at 6/15/2006 1:13:01 AM
create procedure [dbo].[findtext]
(
@fieldname nvarchar(50),
@searchtext nvarchar(50)
)
AS
SELECT * FROM tablename WHERE @fieldname = @searchtext
it doesn't work!... more >>
Query performace problem
Posted by jamiesurman NO[at]SPAM gmail.com at 6/15/2006 12:54:01 AM
We have a query, which accepts a number of parameters.
When the parameter @activeAffiliateCode is set, the following statement
executes, and the query runs very slowly on our LIVE server.
update t
set t.activeAffiliateID = @activeAffiliateCode,
t.Weight = t.Weight + power(2,6)
from @res... more >>
Sort Tab Order
Posted by taha at 6/15/2006 12:00:00 AM
In a case of a table that contain 2 fields : num , name , how can I get an
automatic sorting to maintain the right sequence of numbers when I change a
number in the middle of the table .
Example
Num Name
1 aaaaa
2 bbbbb
3 ... more >>
How to Speed up the query time?
Posted by Steven at 6/15/2006 12:00:00 AM
Hi,
Inside my SQL Server 2000 database, I have a huge table which stored 90
million records and one of the field is "Phone No" which is defined as a
primary key for this table. For my daily operation, I need to select a
random number of records from this table. For example, if I want to get... more >>
|