all groups > sql server programming > december 2004 > threads for wednesday december 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 31
remote database backup
Posted by TJS at 12/15/2004 11:54:55 PM
when I try to schedule a backup, or just do a backup, of a remote database
I get this error message:
"database 'msdb' cannot be opened. It has been marked SUSPECT by recovery."
--I can connect to the database and view it.
--I checked the error logs and there is no information about this er... more >>
Display Rows Into Coulumn
Posted by steve at 12/15/2004 11:41:03 PM
Hi
I have the following rows that I would like to display into coulumn
SELECT StockCode, Warehouse, Qty
FROM StkMaster
WHERE Warehouse IN ('FF','FD','FS')
I would like to represent the data into the following format
StockCode on one line and the warehouse as header and the quantity in t... more >>
Determine length of data in IMAGE field
Posted by Frostillicus at 12/15/2004 10:40:04 PM
Is there a way to return the length of data stored in an IMAGE field?
DATALENGTH doesn't like it and I can't find a corresponding
binary-friendly equivalent.... more >>
Cursor vs Temp Tables
Posted by Joe Williams at 12/15/2004 9:14:03 PM
What is the difference betweeen a cursor and a temp table? When is it
adviseable to use either one?
Thanks
Joe
... more >>
Triggers?
Posted by Joe Williams at 12/15/2004 9:12:38 PM
Is it possible to have an event fire off when crtain conditions are reached
in an SQL table? For intance, if the value of a certain field of a certain
record falls below a predermined limit, or if a certain record is added
based on predetermined conditions, then it could call a stored procedur... more >>
duplicate child records
Posted by Mike Hoff at 12/15/2004 8:24:13 PM
Hello,
I have a child table with a foreign key pointing to its parent. What I want
to do is duplicate one parent's children to another parent.
The child table looks like: ID int, ParentID (int), NAME varchar(10), NICK
varchar(20), AGE (int)
so with records like:
2, 9, joseph, joe, 12
... more >>
Question about error handling
Posted by Alex Glauberzon at 12/15/2004 8:11:51 PM
I have to load large volume of data using insert with select statements,
there is a possibility of data exception errors, is there is method to trap
the error such a way that offending row and column can be identified?
So far as I was unable to do so because messages provided by standard er... more >>
performance question
Posted by Benjamin Janecke at 12/15/2004 6:37:50 PM
Hi,
i want to create a database to store a lot of invoice data as part of a
document management system. the invoices are generated by our financial
application and referred to by "invoice numbers" that look like the
following example:
XXX12345678
as u can see, its got a 3 character pa... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
summary table
Posted by anna at 12/15/2004 5:31:05 PM
I am creating a summary table that would get updated/re-populated every night
to help me deliever summary data to my web pages. Here is what I have now:
tbl_cust: CustID, CustName, etc
tbl_prod: ProdID, ProdCat, ProdSubCat, ect
tbl_time: TimeID, Year, Month, Day, YMD
tbl_sales: SalesID, Cust... more >>
store procedure tutorials
Posted by Test at 12/15/2004 5:26:15 PM
I would like to have some store procedure tutorials
e.g. Table A
Field A: Start Date
Field B: End Date
Field C: status(e.g. 1, 2, 3)
If start date and end date are between 3 months, status 1 will update to 2,
......until 3
Have any website, let me read and programming it.
... more >>
How to Select Last 10 records ?
Posted by Agnes at 12/15/2004 5:25:31 PM
I got a table which hold the container no , that containerno will be used
repeatedly.
E.g it may be resused 10-20 times in one month.
Now, I only need to get the last 10 records for each container no , How can
I do that ?
thanks a lot
--
..
... more >>
help me to replace the sub string
Posted by Matthew at 12/15/2004 4:45:01 PM
I have a column in one table, the data is like the followings
1.DIM)")ELSE(0)+IF(!look(ANA,family=="MSDWSICAV",fundname=="EuropeanProperty")>200000000)(100000000*17.5/10000)
2.
IF(!look(ANA,family=="MSIF",fundname=="EuroStrategicBond")>85000000AND(!look(ANA,family=="MSDWSICAV",
tsEquity")-10000... more >>
SqlCE query
Posted by Sztahoo at 12/15/2004 4:06:02 PM
Hi!
I need to get n rows (ie. 10) starting form m row (ie. 1000). There is no
TOP or LIMIT keyword :/
Sztahoo... more >>
why this Sp never returns -2?
Posted by Leon at 12/15/2004 4:05:47 PM
Why this stored procedure never returns -2? "the SP always returns -1 or
update the account"
CREATE PROCEDURE UpdateAccount
(
@AccountID int,
@EmailAddress varchar(255),
@Password varchar(16)
)
AS
DECLARE @actualPassword varchar(16)
SELECT @actualPassword = Password
... more >>
Immediate help needed with SQL
Posted by DC at 12/15/2004 3:53:09 PM
I need some help with SQL. What will be the SQL to write for the following
problem ?
I have three tables like this -
Table: Project
ProjectId Name
1 ABC
2 DEF
3 GHI
Table: ProjectLeader
ProjLeaderId PLName
1 ... more >>
Configuring Relationships in enterprise manager of sql 2000
Posted by Florian at 12/15/2004 3:44:13 PM
Hello,
I was wondering if it's beneficial for the performance of queries to
configure relationships in Enterprise manager.
We have a main table that has several small "lookup" tables linked to
it. It obviously doesn't hurt to setup relationships for documentation
and data integrity purpo... more >>
Tip on LOOP routine in Stored Procedure
Posted by Mr. Smith at 12/15/2004 3:10:22 PM
Hi.
Pretty new to TSQL and stored proc's, but learning fast.
I have a table tblcompare with tre fields clientID, ival1, ival2.
I need a routine which copy the difference from tblcompare where ival1 <>
ival2 into at a table named tblchecklist together with the clientID.
This is the fields ... more >>
Autopopulate table
Posted by scuba79 at 12/15/2004 2:51:03 PM
I need to know how can I get a table populated with certain data a certain
number of times.
This is the table that I'm using:
CREATE TABLE [Table1] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[Country] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[AreaCode] [char] (10) ... more >>
SQL help needed
Posted by DC at 12/15/2004 1:46:27 PM
I need some help with SQL. What will be the SQL to write for the following
problem ?
I have three tables like this -
Table: Project
ProjectId Name
1 ABC
2 DEF
3 GHI
Table: ProjectLeader
ProjLeaderId PLName
1 ... more >>
SQL-NS files (sqlns.dll) - redistributable?
Posted by iggy at 12/15/2004 1:44:14 PM
Are the SQL-NS (NameSpace objects) files re-distributable?
If the client has a licensed copy of SQL Server, can the SQL-NS files be
installed separately on their workstations?
We don't want to install the SQL client on each PC, we just need some
limited functionality which the NameSpace obje... more >>
join two queries
Posted by Kurt Schroeder at 12/15/2004 1:41:02 PM
I have two queries that i would like to join in a single select
the first is from the stkhst table. I wish to pull all records based on the
given date
the second query grabbs the most current entry for a specific crtcsiid
common key is crtcsiID = stkhstcsisym. THis query should always return a ... more >>
Table Stucture for single column single row table (SSCC)
Posted by Dan Holmes at 12/15/2004 1:38:28 PM
I need to store an integer that i will use to create the next serial
number. It is to create Serial Shipment Container Codes (SSCC in UCC
speak). Everytime i need a new one i read the current and increment by
one. I started with this:
CREATE TABLE [dbo].[SSCC] (
[NextNum] [int] NOT NUL... more >>
Sql clause problem !
Posted by scorpion at 12/15/2004 1:14:11 PM
Hi,
I have a problem like that and I couldn't solve ,
If someone helps me , I will be happy.
How can I do that with sql ?
X Table
A Column B Column
---------- ------------
1 10
1 0
1 0
1 ... more >>
How to count current users in my database?
Posted by Ted W9999 at 12/15/2004 12:59:01 PM
I have a client/server VB 6 application in which the clients are always
connected while using the application. In order to provide tiered pricing of
the program based on the number of concurrent users, I need to know how many
users are currently logged in the system (my database - not SQL Serv... more >>
database of Countries And Locations
Posted by AR at 12/15/2004 12:46:29 PM
Hi,
I need a list of countries and Locations database. Can anyone help me .
regards
aneesh
... more >>
more aggregation
Posted by christy at 12/15/2004 12:37:01 PM
invoice: custid, invoice$, ymd
open: custid, open$, ymd
I need to select the sum of invoice$ and open$ grouped by custid. The
following query is not correct. Do I need to do this in two steps?
select invoice.custid, sum(invoice$), sum(open$)
from invoice, open
where invoice.custid = open.... more >>
How to move accounts and databases between servrs?
Posted by Patrick at 12/15/2004 12:33:37 PM
Hi Freinds,
SQL 2000
I need to move windows and SQL accounts from an old sql 2000 server to a new
SQL 2000 server.
Actually I need to move all databases too.
I will detach and atach DBs. But how should I move win and sql accounts to
new server?
Thanks in advance,
Pat
... more >>
backup
Posted by Preeta at 12/15/2004 12:23:11 PM
I have a backup created on my local machine.I am trying to restore the backup
to a database which is connected through a server.Is this possible? If so
how? Thanks!... more >>
UNION ALL vs. big table
Posted by Nils Magnus Englund at 12/15/2004 12:07:11 PM
Hi,
For a datamart I'm setting up, I'm fetching data from two similar tables
(from two different sources) using DTS. I'm wondering; performancewise and
otherwise, what would be the best way to present this data to the datamart
application?
To insert data from each source into its own tab... more >>
Selecting non-numeric values
Posted by George Hutto at 12/15/2004 11:28:12 AM
Folks,
I have a table wtih a varchar(20) field. This field can contain either
numeric values or non-numeric values (not my choice, just what someone did).
How can I do a SELECT on this table with a WHERE myField is not numeric?
Thanks,
George
... more >>
Newbie Question: xp and config files
Posted by AlanS at 12/15/2004 11:09:03 AM
I am normally a C# devdeloper. I have been tasked with developing a DLL in C#
and creating a XP from that DLL. I would like to be able to associate a
config file with the dll and access the config file dynamically. This is to
support the requirement to move input directories around. I know t... more >>
Replace string data in a phone number field
Posted by Eric at 12/15/2004 11:01:04 AM
Hi,
Im working on importing contact information including a phone number field.
Sometimes users will put various string data like '555-1212' where I want
just '5551212' with no dash. I'd like to be able to replace any string data
that the user enters. Does that involve some sort of IsNumeri... more >>
Add new coloum to a replicated DB
Posted by Chedva at 12/15/2004 10:23:50 AM
I need to add few new colums to a db that is a publisher in replication. If
i add these colum normaly (alter table add column) they wont be in their
table article and to add them to the subscriber side I'll need to recreate
the replication. I remember their is a spesial SP to add the column so th... more >>
EXCEPTION_ACCESS_VIOLATION temp tables full join.
Posted by Wangkhar NO[at]SPAM yahoo.com at 12/15/2004 9:30:43 AM
Wierd errors, running vanilla standard SQL2000, on server 2003. Any
ideas would be helpfull... there are some stack dumps in the logs on
this too.
I am hoping its a service pack issue...
Getting:
generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION
or
[Microsoft][ODBC SQL ... more >>
Variabel parameter for IN-clause in SP
Posted by Eje at 12/15/2004 9:28:12 AM
I need stored procedures with basically the following
content:
select * from mytable where id in(1,2,3)
or
select * from mytable where name in(a,b,c,d)
I want to supply 1,2,3/a,b,c,d via parameter to the sp.
The number of values can vary widely as can the values of
the values.
I suppo... more >>
Can DTS load to a view?
Posted by DWalker at 12/15/2004 9:18:40 AM
SQL Server 2000 SP3.
This might not be doable... But we just horizontally partitioned our
huge transaction table (we get a million transactions a month). Now I
would like the DTS that used to update the table, instead to update the
partitioned view that combines all the underlying base t... more >>
Create Report for Projects by Task by User
Posted by Fred at 12/15/2004 9:15:52 AM
I would like to create a report for Projects that we have setup. I
would like to sort it by User then by Project then Task. Can someone
point me in the right direction to make this happen? I don't even know
which table the Project information is stored in to try and write a
query much less do... more >>
QA
Posted by j1c at 12/15/2004 7:52:57 AM
If I do a select from a text column in Query Analyzer will it return
*all* of it's contents or just XXX chars?
... more >>
Login Failed Error in SQL Errorlog
Posted by Mark at 12/15/2004 7:43:13 AM
We have started recieving following error in the SQL error log. This error is
coming in a row for about 5 minutes and then disappears and then comes back
after few hours. Does it look like a hacking attempt?
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server c... more >>
Can this be done without a cursor?
Posted by sqlboy2000 at 12/15/2004 7:19:23 AM
I'm having a bear of a time trying to accomplish this without using a
cursor. Consider the following table:
create table Increase
(IncID int not null primary key,
BaseAmount decimal(15,3),
Increase decimal(15,3),
IncDate datetime)
Insert into increase
Values
(1, 1000.00, 4.00, '1/1/2004... more >>
max number of row in a cursor
Posted by milly at 12/15/2004 7:17:01 AM
Hi all!
I wonder whether there's a max number of record that a cursor select can
contain..
thanks... more >>
Max number of row in a cursor
Posted by milly at 12/15/2004 7:13:01 AM
Hi all!
I'm wondering whether there's a limit of rows in a cursor...
My select exctracts more than 1,000,000 rows and the cursor defined whit
this...seems not to work properly...
thanks... more >>
Stored Procedure Memory
Posted by Joe K. at 12/15/2004 7:09:04 AM
Is there a switch or parameter within SQL Server 2000 when a stored
procedure is executed on the server it's saved in memory permanent.
Thanks,
... more >>
Update from 1 table to another
Posted by Poppy at 12/15/2004 6:55:53 AM
I am having a major problem using this query in SQL Server
2000 :
[CODE]
UPDATE tblTreatment
set tblTreatment.ltblProcedureID =
(
select ltblProcedure.ltblProcedureID from ltblProcedure
WHERE tblTreatment.GRDTypeofTreatmentPerformedId =
ltblProcedure.OldGRDId
)[/CODE]
I keep get... more >>
query results
Posted by jmeyers at 12/15/2004 6:39:04 AM
I'm wanting to get the data from a select statement without the header
information in query analyzer. For example,
select iCompanyId from Company where iCompanyId = 15812
will give me
iCompanyId
--------------
15812
What I want to get is simply
15812
Can I do this?... more >>
Setting default dateformat in SQL Server
Posted by Bernie Beattie at 12/15/2004 6:13:06 AM
Is there somewhere you can set the default dateformat to dmy in SQL Server so
you don't have to set it every time you do a select? I'm having difficulty
finding the option.
Thanks for any help,
Bernie... more >>
Getting autoinc value that reset everu new year
Posted by checcouno at 12/15/2004 5:47:09 AM
I need to save an autoincremental value in mytable resetting this value every
new year automatically.
Example:
myTable is: myPKField, myField1, myField2, ..., myAutoIncField
during year 2004 myAutoIncField has reached 1000, the first value in year
2005 should be 1!
I don't want use jobs, ... more >>
getting error text
Posted by sorinr NO[at]SPAM gmail.com at 12/15/2004 5:45:33 AM
Hi all,
I have two nested stored procedures. From the inner sp I raise an user
defined error with RAISERROR. From the outer stored procedures I want
to read the text of the error raised in the inner stored procedure. Is
there a way to acomplish this?
Thank you all,
Sorin
... more >>
select statement using date clauses problem
Posted by Bernie Beattie at 12/15/2004 4:53:07 AM
Is this the correct syntax for a select for records matching a particular
date range?
select * from myfile where mydate>'31/12/2002'
Sometimes (yes only sometimes) I get the error:
The conversion of a char data type to a datetime data type resulted in an
out-of-range datetime value.
I th... more >>
remove left-hand zeros
Posted by robert at 12/15/2004 12:53:02 AM
hi,
how can i remove leading zero in an char-field.
01 --> 1
01A --> 1A
02A --> 2B
thanks... more >>
|