all groups > sql server programming > august 2006 > threads for wednesday august 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
Iterating through SQL Server data
Posted by onecorp at 8/30/2006 11:29:02 PM
onecorp 6/28/2006 5:57 PM PST
Question
I have a stored procedure which compares one column of a table against each
of the other columns in the same table. If it finds a 'one' in each column,
it counts the number of 'paired data' . As there can be up to 60 columns and
60 rows in... more >>
Validation queries running too long
Posted by ngorbunov at 8/30/2006 11:11:40 PM
I have a table that contains approx 200 thousand records that I need to run
validations on. Here's my stored proc:
[code]
CREATE PROCEDURE [dbo].[uspValidateLoadLeads]
@sQuotes char(1) = null, @sProjectId varchar(10) = null, @sErrorText varchar
(1000) out
AS
BEGIN
DECLARE @ProcName sysname... more >>
Graph Representations
Posted by Karch at 8/30/2006 9:33:30 PM
Experts,
I have a problem that's twisting my mind up. The summary of the problem is
that I have table of organizations, each of which can function in one of two
roles at any given time - call them Role A and role B. These organizations
will have relationships between them (I imagine it prog... more >>
sql server 2005 documentation
Posted by Jeff at 8/30/2006 7:38:54 PM
hey
I'm looking for the link to the sql server 2005 agent's online documentation
a link would be great!
BTW, can I run Sql Server 2005 on winxp pro (sp2)?
Jeff
... more >>
SSIS Connection Manager changing connection string
Posted by Colin Dawson at 8/30/2006 6:56:42 PM
Hi all.
I'm working on an SSIS package in SQL 2005. At the moment, I'm developing
the package on my development machine. Once complete I want to deploy the
package to several different servers. Fairly straight forward so far....
I have a connection manager that connects to a database ... more >>
SQL Server 2000 Parameter Sniffing HELP!!!!!
Posted by DotNetNow at 8/30/2006 6:52:01 PM
I am / was using declare @Variable statements with Select @Variable to build
some date strings and then using those date strings as paramters in queries.
The select statements using these date variables are performing poorly. I
have analyzed the query plan and I have added additional fields... more >>
Selecting a record based on alpha range?
Posted by Linn Kubler at 8/30/2006 4:37:13 PM
Hi,
I have a table with three fields, user_id, payer_code and alpha_range.
With records like:
'PD', 'D', 'a-l'
'BC', 'D', 'm-z'
'BH', 'C', 'm-z'
'JE', 'C', 'a-l'
If the alpha_range field relates to the first letter of the last name how
can I query the correct record? I'm interested in ... more >>
Require One of 3 Columns NOT NULL
Posted by Smithers at 8/30/2006 4:25:52 PM
2K5: How can I enforced the requirement that [at least one of 3] columns be
NOT NULL? I don't care if 0, 1, or 2 of the 3 columns have a NULL value - I
just want to require at least one of the 3 columns to have a value [not
NULL] when a new row is inserted - and I don't care which one has the... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
help with select
Posted by BJ at 8/30/2006 4:10:56 PM
I have 300 records in one table. I want to select that in 3 times, each time
100 rows.
Anyone have some idea how to do that??
So, I would have 3 queries and each query would get 100 records.
If anyone can help....
Thanks!!
... more >>
SQL to FoxPro text to memo
Posted by Chris at 8/30/2006 3:47:02 PM
I'm using DTS to export SQL2000 data via a query to FoxPro6.0 free tables.
I'm able to export if the query doesn't contain text fields but as soon as I
try to export with a text field it errors. I see in the transformation that
it correctly identifies the destination field as M. The error I... more >>
stored procedures problem
Posted by param NO[at]SPAM community.nospam at 8/30/2006 3:26:05 PM
Hi all,
I have a stored procedure that executes multiple statements and returns
multiple resultsets. We have begun to notice that 80% of the time it runs
fine. However, 20% or so of the time SQL Server kicks back the following
error:-
(0 row(s) affected)
Server: Msg 1205, Level 13, ... more >>
Datetime field overflow
Posted by Middletree at 8/30/2006 2:58:56 PM
22008 Datetime field overflow
I'm getting this error all of a sudden. I'm using SQL Server 2000 with an
app that has been working fine for months with no recent changes.
BOL isn't telling me anthing I can use, and I'm not seeing anything on
Google, either. Anyone know what this error means?... more >>
Sumproduct in sql
Posted by Stopher at 8/30/2006 2:42:12 PM
Hi all,
I am trying to replicate a spreadsheet into an sql query and one of the
formulas is SUMPRODUCT. I am trying to work out the SQL to make this
happen.
Problem.
Example data
1 SHIP0239 DMT 8785.546
1 SHIP0239 ZN 56.72649
2 SHIP0239 DMT 9865.723
2 SHIP0239 ZN 56.84675
now the... more >>
Sumproduct in sql
Posted by Stopher at 8/30/2006 2:41:13 PM
Hi all,
I am trying to replicate a spreadsheet into an sql query and one of the
formulas is SUMPRODUCT. I am trying to work out the SQL to make this
happen.
Problem.
Example data
1 SHIP0239 DMT 8785.546
1 SHIP0239 ZN 56.72649
2 SHIP0239 DMT 9865.723
2 SHIP0239 ZN 56.84675
now the... more >>
Openrowset Text Truncation
Posted by seamlyne NO[at]SPAM hotmail.com at 8/30/2006 2:39:57 PM
I've got a truncation problem with the following statement:
select *
from OpenRowset(
'MSDASQL',
'Driver={Microsoft Text Driver (*.txt;
*.csv)};DefaultDir=\\11.181.11.41\ftpusers\Homenet\xyz\;IMEX=1;',
'select * from xyz.txt')
or
select * from OpenRowSet(
'Microsoft.Jet.OLEDB... more >>
Naming MDF and LDF files
Posted by Ronald S. Cook at 8/30/2006 2:33:36 PM
I know that, by default, SQL Server 2005 suggest files MyDatabase.mdf and
MyDatabase_log.ldf for the file names. I think that SQL Server 2000 might
have even suggested MyDatabase_data.mdf for that file.
I like brevity and consistence. Would naming them simply MyDatabase.mdf and
MyDatabase... more >>
Regression in SQL Server
Posted by Ash at 8/30/2006 2:23:32 PM
I looked for how to do this on the internet and found the following
functions:
+-REGR_R2------------+
+-REGR_SLOPE---------+
+-REGR_SXX-----------+
+-REGR_SXY-----------+
'-REGR_SYY-----------'
This was on a DB2 site. Are there equivalent functions in MS SQL
Server?
Than... more >>
2005 backward compatibility...
Posted by Charlie NO[at]SPAM CBFC at 8/30/2006 1:56:53 PM
Hi:
My applications access data using SQL 2000. I'm builing a new machine and
would like to switch to SQL 2005. Will my applications (built using 2000)
still run or do I need to install both 2000 and 2005 on same machine?
Thanks,
Charlie
... more >>
ALTER VIEW does not refresh
Posted by Mav at 8/30/2006 1:39:02 PM
From VBA I issue a DoCmd.RunSQL "ALTER VIEW ..." and then I run the new View.
Problem is, the results it gives are the previous SQL string and not the new
one. Only when I open the View in design view does it refresh.
Any suggestions?
--
Mav... more >>
removing unused columns
Posted by lord.zoltar NO[at]SPAM gmail.com at 8/30/2006 1:29:19 PM
I have a very large table that I have imported from a legacy system. It
seems to me that almost a third of the columns in this table are NEVER
used, and never will be. How can I query the table to see the names of
the columns which have NO value for any row, so that I can remove them
from the sy... more >>
updatetext issue
Posted by Anil at 8/30/2006 12:45:01 PM
Hello Sir/Madam,
I am trying to use opendatasource with the updatetext as I am trying to
update a blob which is on another server that does not allow me to add any
procedures, etc. However, I get incorrect syntax error (Incorrect syntax near
the keyword 'OPENDATASOURCE') .when I use the ope... more >>
filtering the results in my 87MB *.trc file
Posted by kevin at 8/30/2006 12:23:02 PM
using 2k and 2005...
I have a trace file that is 87mb. I really only want to see lines with the
duration value of the final completed statement.
The INSERT uses a udf, thus creating a seperate line for each row of data
that was inserted. If I inserted 100 rows, the trace has 200 rows, th... more >>
hierarchical query 2005
Posted by eladla at 8/30/2006 12:19:02 PM
I am working with visual studio 2005 and sql server 2005 workgroup edition.
I have three tables where each row has an ID and a PID.
What I want to do is create either a hierarchical query to fill a data set
or create the dataset itself as an hierarchial dataset.
Is this possible with the tools ... more >>
problem with select
Posted by plan9 at 8/30/2006 11:21:02 AM
Hello
I'm trying to do a select and I'm having a problem with it (code below)
declare @teste_varchar2 as varchar(20)
declare @teste_varchar as varchar(500)
set @teste_varchar2 = "valor_fact"
exec ('select ' +@teste_varchar2+ ' from ##CONTENC where con... more >>
sp_OAMethod error
Posted by Hong Wang at 8/30/2006 11:21:02 AM
Hi,
I have used EXEC @hr = sp_OAMethod @object, 'Connect', NULL, 'my_server',
'sql_login', 'sql_password' to test if a remote SQL box is up.
It returns to me an error with '[Microsoft][ODBC SQL Server Driver][SQL
Server]Login failed for user 'SPC\sqladmin'.
I noticed that SPC\sqladmin... more >>
max size of the record in each field
Posted by PushparajK NO[at]SPAM gmail.com at 8/30/2006 10:53:46 AM
Ok
I want to find out the max size of the record in each field
For eg
My table has four records and the Name Field has
Raj
John
Mike
Robert Kennedy
My Query should return 14 as the result.
Thanks very much if you have a solution
... more >>
help to speed query
Posted by JFB at 8/30/2006 10:43:47 AM
SELECT p.*, o.pName, u.name FROM dbo.PrintersJobs p
inner Join Orders o on
p.orderid = o.orderid
left outer join users u on
p.dataperson = u.userid
ORDER BY p.TimeEntered DESC, p.jobid desc
Hi all,
I have a query that it takes to much time to run.
In my PrinterJobs table I have about 2300 ... more >>
Force Leading Zeroes
Posted by Pancho_11 at 8/30/2006 9:55:01 AM
Hello,
I have a char(4) field with values like this:
22
6
1234
335
I want all values to get a preceding 0 if they are less than 4 characters,
to look
like this:
0022
0006
1224
0335
Searched around this forum but couldn't find a match. I can change the
field data type if necess... more >>
View limitations?
Posted by William Sullivan at 8/30/2006 8:48:01 AM
I was trying to do a complex view with declares, sets that use selects, and
the main query which uses case statements. I've tried to create this view
using Enterprise manager and VS, but the result is always the same.
Once I have the whole shebang down, I run it to make sure it works, whic... more >>
Missing Stored Procedures
Posted by KellyLeia NO[at]SPAM gmail.com at 8/30/2006 8:29:57 AM
Can anyone tell me where I'd find these stored procedures. They're from
an execute sql task step in DTS. I checked the db that the task is
connected to, and can't find anything that even resembles the stored
procedures (i think) are being called. It's (in theory because i can't
find them anywhe... more >>
Passing parameter into SP for permissions?
Posted by brett at 8/30/2006 8:22:38 AM
How can I pass a user name into a stored procedure I've created that
assigns certain table and SP permissions? The EXECUTE doesn't seem to
allow variables when permissions are involved. It wants literals, i.e.
'John' instead of @username.
Thanks,
Brett
... more >>
How to find Columns
Posted by Shyam at 8/30/2006 8:14:03 AM
Hello,
My question could be strange or silly sometimes, but wanted to check if
there are any possibilities.
Q: Is it possible to find out the existance of the Column in a huge DB which
has 100's of tables in it, say Col A exists in Table Z,but, and it's diffcult
to remember the columns in ... more >>
OLEDB2 COULD NOT INSERT INTO TABLE
Posted by bsheikh at 8/30/2006 8:02:34 AM
HI FRIENDS,
I AM TRYING TO INSERT INTO DB2/AS400.
ALL THE PROCEDURE WAS WORKING FINE AND NOW I AM GETTING FOLLOWING
ERROR
--------------
Server: Msg 7343, Level 16, State 2, Line 1
OLE DB provider 'DB2OLEDB' could not INSERT INTO table '[DB2OLEDB]'.
[OLE/DB provider returned message: A SQL... more >>
Search for a field in the sys objects
Posted by UnglueD at 8/30/2006 7:45:34 AM
Hello,
I am working on an update to an application that requires me to know
the contents of some 'vchEnrolled' field. The problem i'm running into
is that the database is horribly redundant and information is strewn
everywhere. I am not sure where this field is located.
I was hoping f... more >>
SQL Server: query multiple databases
Posted by lord.zoltar NO[at]SPAM gmail.com at 8/30/2006 7:42:09 AM
I am trying to query multiple databases in SQL Server 2000 using SQL
Query Analyzer.
Query Analyzer seems to be able to query only one database at a time.
IF I'm connected to the database "a1", I can query the tables quite
easily in a1, but not in database a2.
I've tried the syntax:
SELECT... more >>
Detect Changes Using Checksum
Posted by Dave at 8/30/2006 7:36:02 AM
Hi,
I am working on a project which integrates diverse and often unreliable data
sources. I need to check for changes in source data on a daily basis. I
import data into MSSQL 2000 and using checksum functionality I compare
yesterday's snapshot of the data with today's. I run a SProc which ... more >>
Import data from Excel to SQL server
Posted by amit at 8/30/2006 7:25:21 AM
hi All,
I am facing some problem in linked servers. Actually i want to upload a
excel file into the SQL Server. I have tried this through
sp_addlinkedserver and connected successfully but when i tried to fetch
records through this i got an error as:
Server: Msg 7399, Level 16, State 1, Line 1... more >>
Difference between using TRANSACTION ISOLATION LEVEL READ UNCOMMITTED and NOLOCK
Posted by KJ at 8/30/2006 7:08:10 AM
Hello All,
Is there a difference between specifying NOLOCK on all select
statements in a batch versus starting the batch out by executing the
statement SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED?
I was hoping to use the SET command to avoid having to write NOLOCK
after each table in e... more >>
Conditional Selection in T-SQL
Posted by zachi.fernaldes NO[at]SPAM hp.com at 8/30/2006 7:04:51 AM
Hello all,
I need to create SP which dynamicaly select and display spesific
fields.
Those fields will be used for grouping as well.
I'll show you only the relevant part in the SP;
@Planet as varchar(50),
@Press as varchar(50)='NUL',
@Engine as varchar(50)='NUL',
@Test as... more >>
Trigger creation loop on user tables?
Posted by Fekete_B=E1lint at 8/30/2006 4:16:01 AM
Hello.
I have an another problem in connection with my previuos question:
(
http://groups.google.co.hu/group/microsoft.public.sqlserver.programming/bro=
wse_thread/thread/49dc6d8552a38042/20bf578fe8b1674d?lnk=3Draot#20bf578fe8b1=
674d
)
There is a database and every user table has two col... more >>
timstamp compare problem
Posted by Endo at 8/30/2006 4:06:10 AM
i have a table with a timestamp column, and there is a record with
timestamp value 0x0000000000011174
when i execute the following select query:
select * from mytable where ts > 0x0000000000011170 --this works fine,
it returns the record,
select * from fis where version> 4467 --this also ... more >>
How to get results output from a nested stored procedure
Posted by Stephen K. Miyasato at 8/30/2006 3:52:34 AM
I have the following procedure that passes parameter to another stored
procedure as noted below.
On the exec FLG_SelectFlagsDue @PatNo,@IncludeMemo, @memo
3 input parameters are passed and the @memo parameter is the output
parameter.
I can use a print statement in the FLG_SelectFlagsDue whi... more >>
select min column value in a row
Posted by gracie at 8/30/2006 3:44:02 AM
Hi,
How can I select the minimum column value within a row?
ex:
table1
colA colB colC
100 200 300
500 700 800
800 400 200
The first record should return 100.
The second record should return 500.
The third record should 200.
... more >>
Connection to server very slow/timeout expired error
Posted by daffy at 8/30/2006 2:43:28 AM
This is a "was working yesterday" issue. On our PCs trying to connect
to MSDE 2000 SP4 (via .NET SqlServer Connection object) resulted in a
"timeout expired" message (using default 15 seconds timeout)
This is only happening when connecting to MSDE. Full blow/developer
editions are fine.
T... more >>
To Select or Not To Select
Posted by rocket salad at 8/30/2006 1:41:02 AM
I have a view sat on a server which I want to make sure no-one can select
from when at certain points of the day when a processor heavy job is running.
There is a value in a database which indicates whether the process is running
or not. I can see two ways of doing this:
1. Make a business ... more >>
Reading .trc files on SQL Server 2000/2005
Posted by adkompella at 8/30/2006 12:51:53 AM
Hi,
We have a requirement to read the .trc files generated by SQL server
in real-time or atleast near real-time. We do not want to interfere
with existing SQL server setup by running functions like
fn_trace_get_table. The requirement is to get the events logged in .trc
files by directly readi... more >>
restoring from backup
Posted by mark at 8/30/2006 12:00:00 AM
I need to restore a table in a database using sql server 2005
how do i do this ? - restore wants to restore the whole database (which also
isnt working)
... more >>
Trigger PK
Posted by Jon Vaughan at 8/30/2006 12:00:00 AM
Hopefully this is a quick one :
Using a trigger how can I get the PK of the row thats been affected, say
updated.
... more >>
Advanced subquery ??
Posted by Vilma at 8/30/2006 12:00:00 AM
Hi All.
I need a query that will indicate the number of receipts on posted
formulars. But I can not figure out how :(
I have got two tables
Formulars
Receipts (relates to Formulars with FormularID)
SELECT *, COUNT(????) AS ReceiptCount FROM Formulars
Cheers
Vilma
... more >>
Multi-step OLE DB error
Posted by dw at 8/30/2006 12:00:00 AM
Hi. One of our classic ASP apps is throwing an intermittent error when
connecting to a remote SQL Server 2000 using the openrowset technique,
[OLE/DB provider returned message: Multiple-step OLE DB operation generated
errors. Check each OLE DB status value, if available. No work was done.]
... more >>
|