all groups > sql server programming > may 2006 > threads for wednesday may 24
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
Previous row calculations using SQL
Posted by mmonis at 5/24/2006 11:21:52 PM
Hi,
I need help in writing a SQL, where in a calculated column depends on
previous's row column, for example,
Table: test
Time Pkts Seq_no
---------------------------------
10:00 20 25
10:01 15 40
10:02 17 57
10:03 10 60
10:04 12 72
Query Result: The output of the query should b... more >>
Can we do the Validations in bcp format file
Posted by Veeru at 5/24/2006 10:39:01 PM
Hi
I need few clarifications. I am using bcp 9.0 tool to load the data into the
table in SQL Server 2005.
Can we do validations in bcp format file.
The validations like
1. if the datafile field data is "ABC" I want to insert the data into table
as "DEF" or if the datafile field data i... more >>
Can we specify the format of the date field in Format file
Posted by Veeru at 5/24/2006 10:00:02 PM
Hi
We are using Format files to load the flat file data into the table in SQL
server 2005 and using bcp utility (version 9.0).
Can we specify the format of the date field in Format file to load the date
into the table column.
for example we can specify the date field format in SQL Loader co... more >>
Row Correlated calculation Query
Posted by mmonis at 5/24/2006 9:21:15 PM
Hi,
I need help in writing a sql, where a calculated column depends on
previous's row column, for example,
Table: test
Time Packet Seen Seq_num
---------------------------------
10:00 20 25
10:01 15 40
10:02 17 57
10:03 10 ... more >>
Equivalents For sysdatabases and syslogins?
Posted by Derek Hart at 5/24/2006 7:26:07 PM
Are there equivalents for sysdatabases and syslogins that are guaranteed in
future versions of SQL Server?
... more >>
best/fastest why to do this - high level
Posted by John Smith at 5/24/2006 6:30:54 PM
Hello
Here is table
FileID FileType DateCreated Active
1 Revised 1-Jan-06 1
1 Revised 2-Jan-06 1
1 Created 3-Jan-06 1
2 Created 4-Jan-06 1
2 Revised 5-Jan-06 1
3 Created 6-Jan-06 1
3 Revised 7-Jan-06 1
3 Revised 8-Jan-06 1
3 ... more >>
Linked server
Posted by imtiaz at 5/24/2006 5:57:18 PM
How to create a linked server in MS SQL 2000?
... more >>
Updating SSN column with incrementing numbers
Posted by danlin99 at 5/24/2006 5:47:01 PM
Hi,
I need to desensitize our employee table by upating the SSN_ID column with 9
digit incrementing numbers. TIA
Example:
Empl_ID SSN_ID
7100 000000001
7101 000000002
7102 000000003... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Deleting a login account
Posted by scott at 5/24/2006 4:54:51 PM
I'm getting the below error when trying to change a few properties for a
login account. If I delete the login from Ent. Manager and then create a new
login with the same name, I get the same error.
I can create a new user as long as i use any other name. How can this
account already exist a... more >>
Converting negative numbers to positive
Posted by MittyKom at 5/24/2006 4:41:02 PM
Hi All
I have a table with column Col2 with negative and positive numbers. I would
like to query the col2 and make sure all the negative numbers are converted
to positive in the resultset.
eg
Tb1:
Col1 Col2
---- -----
a -1
b -2
c 3
select col2 fro... more >>
Update integer value based on "group by" clause
Posted by dw at 5/24/2006 3:40:13 PM
Hi, all. We've got a table that looks like this,
CREATE TABLE [tblApplicantRef] (
[UserID] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Position] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Confirmation] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI... more >>
OUTER JOIN issue
Posted by FJC at 5/24/2006 3:24:02 PM
The following stored procedure was created by one of our developers and it's
taking too long to be executed, we already identified that the section of the
coding with the problem are the outer joins, can anybody suggest something to
improve it?
Thanks
-- Populate performance layer table wi... more >>
MS SQL Server 2000 - Run query as a different user
Posted by Dmitri Shvetsov at 5/24/2006 2:12:05 PM
Can we run some query as a different user working with MS SQL Server 2000?
For example if we connected to the DB in the Enterprise Manager as User1,
can we run some query as User2?
We need to select from a VIEW pulling data from some DB, we can encrypt the
text of this view hiding the targe... more >>
Permissions
Posted by Dmitri Shvetsov at 5/24/2006 1:56:00 PM
All,
How can we grant the permissions to the user to SELECT from some view on one
database which is pulling the data from several tables on another database
but hide the structure of these tables for this user? The problem is the
following, if we don't grant the permission to SELECT from th... more >>
For Each Loop Container in SSIS
Posted by Shiva at 5/24/2006 1:52:37 PM
Is anyone aware of any good links on how to use the
For Each Loop Container for ADO.NET dataset?
Thanks,
SHiva
... more >>
Help with SQL query
Posted by dan_williams NO[at]SPAM newcross-nursing.com at 5/24/2006 1:42:14 PM
I have a ContactTypes table as follows:-
ContactTypeId int PK
ContactType varchar(50)
I have several different types of contact types (i.e. Invoice,
Business, Manager, Home, etc).
I have a Client table as follows:
ClienttId int PK
ClientName varchar(50)
I have a ContactAddresses... more >>
View for accumulate data
Posted by Feches at 5/24/2006 1:28:02 PM
Hi all,
I have a table with product in/out and I need to calculate my stock at any
date.
For example:
Date Product IN/OUT
01/05/2005 1 5
01/05/2005 1 -4
02/05/2005 1 1
02/05/2005 2 6
02/05/2005 2 -6
03/05/2005 3 5
03/05/2005 2 3
03/05/2005 3 -2
03/05/2005 1 2
If I see t... more >>
Need help with poorly performing SPROC
Posted by Corky at 5/24/2006 1:26:39 PM
I have a SPROC that gradually slows to a crawl. It processes roughly
38,000 records from a staging table, makes some alterations to data,
and subsequently calls other SPROCS to either insert or update
production data based on what is in the staging table.
When I initially created it, I opened ... more >>
Check for constraint on delete
Posted by hals_left at 5/24/2006 1:10:50 PM
How do you code a procedure to delete a record where if it has an
error (because of foeign key constraint , no cascade and related
records) it will continue and do an update instead.
I have tried this but it doesnt continue if the delete hits an error.
Thanks
Create procedure dbo.delete_re... more >>
watching a column value
Posted by hugonsantos NO[at]SPAM gmail.com at 5/24/2006 12:42:47 PM
Hi!
I would like some help on creating a trigger to watch a column value.
The objective is the following: when a values is equal to 1 for 5
seconds or so, change it to 0.
Thanks
Hugo
... more >>
trailing spaces in columns
Posted by David at 5/24/2006 12:40:02 PM
How can I the number of trailing spaces in a colum of the table?
Thanks!... more >>
Extract a character string from a text field
Posted by FinnGirl at 5/24/2006 12:05:03 PM
I need to extract a character string from a text field. The string I'm
looking for will always start with the first four characters of "ABC-" and
then will end with three numbers (0-9) in varying combinations, ex.
"ABC-508". The problem is that the position of the string in the text field
... more >>
Statistics on each column
Posted by Curious Joe at 5/24/2006 10:39:24 AM
My company gets new data from clients all of the time. It is good to
be able to generate statistics on each column of data we get. The
following needs to be gathered on each column.
minimum value
maximum value
# times null
# times 0 (on number columns)
# times all spaces (on char columns)... more >>
Need help inserting into row, not adding a row
Posted by Matthew at 5/24/2006 10:26:05 AM
I am trying the write a query that will collect information on the
status of the server. This is not a mission critical query, but rather
an informative one. I know that some people have issues running
undocumented commands
Anyway the question that I have, is there an elegant way for retiring
... more >>
Update table with stuff from another table?
Posted by rhaazy at 5/24/2006 10:20:00 AM
Using ms sql 2000.
I have this table in my database.
CREATE TABLE [dbo].[tblScanDetail] (
[ScanDetailID] [int] IDENTITY (1, 1) NOT NULL ,
[ScanID] [int] NULL ,
[ScanAttributeID] [int] NULL ,
[Instance] [int] NULL ,
[AttributeValue] [nvarchar] NULL ,
[DateCreated] [smalldatetime] NULL... more >>
Index of length xx exceeds the maximum length
Posted by Joe at 5/24/2006 10:08:02 AM
Hi,
my program inserts data into a table and it's throwing an exception (below).
I'm not a SQL Server bod so can anyone tell me if there is an alter statement
to increase the size allocated to the index or otherwise what I should do.
The index entry of length 1235 bytes for the index 'ixPDM_... more >>
Question on building Time Zone Tables, Daylight Savings Time Table
Posted by br at 5/24/2006 10:05:02 AM
I wanted to ask the community if my approach to building tables for Time
Zones and Daylight Savings Time is correct. I would like to build with the
following thoughts in mind: 1) time zones are an offset (in hours) to GMT, 2)
adjustments to time zones can be made during Daylight Savings Time,... more >>
Help using COALESCE on field containing NULL
Posted by ZRexRider at 5/24/2006 9:30:50 AM
Hi
I followed example of using COALESCE to create a stored procedure that
I could pass parameters to instead of dynamically building a "WHERE"
clause in a SQL statement.
http://www.sqlteam.com/item.asp?ItemID=2077
I have a table that has 772 rows in it. 93 of the items have no value
for... more >>
MCDBA Certification
Posted by Mark at 5/24/2006 9:07:02 AM
Hi All:
What books some of you recommend for MCDBA 2000 preparation?
Thanks in advance
... more >>
Convert date format into May 24, 2006
Posted by MittyKom at 5/24/2006 8:27:01 AM
Hi All
How can i covert the date format into May 24, 2006
Below is what i have tried:
select CONVERT ( varchar(50) , getdate(), 101)
Thank you in advance... more >>
bcp, empty strings and null
Posted by Ste at 5/24/2006 8:25:03 AM
Not sure if this is the right section...
I've got a problem with empty strings in a table turning into null (ascii
code 0x00) values when bcp'ed out to file:
When I bcp out of a table columns that have an empty string in them get
written to file as a null value (ascii code 0x00).
For ... more >>
check if field contains numeric character
Posted by samuelberthelot NO[at]SPAM googlemail.com at 5/24/2006 6:42:50 AM
How can I select all of the rows of my table for which a certain
field's value contains other characters than a-z and A-Z (non alpha
string) ?
Thank you
... more >>
Can we call functions that assign a value to a field
Posted by JP at 5/24/2006 6:37:02 AM
Can we call functions that assign a value to a filed. For example, we use
oracle sequence to assign a value to fields. Since SQLSvr does not have
sequences, can a function be used instead to assign a unique value in BCP
tool. ... more >>
XML input; Have insert can't figure out updates.
Posted by rhaazy at 5/24/2006 5:43:18 AM
I have an app that performs scans on all our company PCs and returns
information
like what windows updates it has, services running, programs installed,
browsesr history, etc. Scans will be performed once a week and sent to
a server via XML(one xml doc per one computer scan). The server will
... more >>
parsing Vabinary contnt
Posted by Bill nguyen at 5/24/2006 5:29:55 AM
Where to find the syntax for parsing varbinary data in SQLserver?
Thanks
Bill
... more >>
How to access Webservice from SQL Server 2000
Posted by SqlBeginner at 5/24/2006 4:07:01 AM
Hi All,
How to access / invoke a webservice from SQL Server 2000? i.e, from within a
SP i would like to call an existing webservice.
I know using HTTPEndPoints we can do that in SQL 2005. Is there any work
arounds in SQL 2k?
Regards
Pradeep... more >>
Post-Relational Databases
Posted by NH at 5/24/2006 2:53:01 AM
I just recently came across Post-Relational databases, strange I never heard
of them before. Anyone any experience of them, are they going to be the next
generation of databases as I heard one guy claim!?
Thanks
N... more >>
Calculated Columns
Posted by Aviad at 5/24/2006 2:04:02 AM
Hi,
In have a select query with one calculated column in the select column
collection. When I change the select FROM clause from table name to a table
defined with select statement, I get error. The query is:
DECLARE @YearsSet TABLE (
[YEARCOLTIME] VARCHAR(8000))
INSERT @YearsSet
SEL... more >>
How to manipulate column data to place in a temporary table
Posted by stephen.tys NO[at]SPAM gmail.com at 5/24/2006 2:03:40 AM
Hi all.
I tried posting a question earlier this week regarding this topic but
didn't really know where to start. Anith pointed me in the right
direction (thank you, Anith) and I have now done a little more research
into exactly what I'm trying to achieve.
What I'm trying to do is copy a co... more >>
Scripting database, table, view and SP creation all in one
Posted by RobGT at 5/24/2006 12:00:00 AM
Hi,
I want to be able to run a script(?) that will create a database
(dynamically named) and then populate that new database with some tables,
views and stored procedures.
I was thinking of using DTS, but cannot find information on how to create a
package that accepts the database name as a ... more >>
Get the SQL Server Unique ID of the Server
Posted by Edward Low at 5/24/2006 12:00:00 AM
Hi All,
Is there any ID / Key which identify the server of the SQL Server
installation uniquely? I need this ID to make sure the database installed in
a SQL server can't be transferred to other SQL Server, for licencing issues.
Or, is there other ways to achieve this?
Thanks & Regards,... more >>
sp_addextendedproperty
Posted by Joel Zinn at 5/24/2006 12:00:00 AM
I am needing to programmatically insert/update data in the sysproperties
table in SQL Server 2000. When I tried to do this with ad hoc queries, I
get an error stating that ad hoc queries are not allow on system tables. I
found references to the sp_addextendedproperty system stored proc, but ... more >>
Best way to take backUp
Posted by imtiaz at 5/24/2006 12:00:00 AM
Which is the best way to take BackUp of the DB from MSSQL 2000 to a
secondary server with out loosing any single Insert/update?
... more >>
placing table on the memory
Posted by Roy Goldhammer at 5/24/2006 12:00:00 AM
Hello there
I have reference localAreaCode table with 3000 records , i need to check on
existing phone table that the area code exist on LocalAreaCode table.
So far the query worked very slow.
Is there a way to place the LocalAreaCode table at the memory, to inprove
perfomance?
... more >>
what to do when identity overflowed
Posted by Tarvirdi at 5/24/2006 12:00:00 AM
I Have a table that acts as Buffer (FIFO) and use Unique(Identity).
Naturally after some while I will get overflow how can I prevent it
solution 1: loop to zero- useless, makes problem for records order
solution 2: during some periods (monthly) adjust to zero ( e.g. : current id
1000-1200 and c... more >>
List of weeks
Posted by Frederik Vanderhaeghe at 5/24/2006 12:00:00 AM
Hi,
I would like to have a combobox that is filled with a list of the weeks of
the year, starting on a sunday and ending on a saturday, except when the
year doesn't start on a sunday or ends on a saturday, then it should
start/end with the date.
So for the year 2006 it should be:
01-01-... more >>
Shedule DB BackUp in SQL 2000
Posted by imtiaz at 5/24/2006 12:00:00 AM
How to shedule a daily backup of DB in MS SQL Server 2000?
... more >>
using cursors
Posted by Roy Goldhammer at 5/24/2006 12:00:00 AM
Hello there
I have table that i need to add to another table.
according to some data some actions should be taken:
1. if the key not exist on source adding the reocord
2. if the key exist on source updating the record
3. if fld1 is 'AB' set on destination '12' else '34' ect.
for this i t... more >>
|