Home All Groups Group Topic Archive Search About

SQL Server database programming

microsoft.public.sqlserver.programming
Score Any SQL experts?
amy - 25 Mar 2006 4:16 PM - 7 messages
Hi, I have an SP that was working fine (took about 10 mins to process). I've added a section of the SP below for reference.  Here is an overview of my table structure (simplified). EMPLOYEE TABLE employeeid name ...
Score Authentication
christof - 25 Mar 2006 2:20 PM - 4 messages
Let's say we've got 2 computers - [A] and [B] where is a SQL Server. Is it possible to make user from [A] log into instance of SQL Server on [B] with Windows Authentication? So is there a possibility to create a ...
Score Query help
Niclas - 25 Mar 2006 12:41 PM - 3 messages
Hi, I am struggling with a SQL query and was hoping to get some help. This is a simplifed scenario: I have 2 tables Table1 Results with 2 columns USERID (int) and RESULT (datetime) Table 2 Users UserID (int), firstname (varchar), lastname(varchar) ...
Score Query help
Niclas - 25 Mar 2006 10:21 AM - 2 messages
Hi, I am struggling with a SQL query and was hoping to get some help. This is a simplifed scenario: I have 2 tables Table1 Results with 2 columns USERID (int) and RESULT (datetime) Table 2 Users UserID (int), firstname (varchar), lastname(varchar) ...
Score blank query window- how to get?
mrmagoo - 25 Mar 2006 12:07 AM - 7 messages
In Sql Server Query Analyzer, to get a blank query window, it seems that I must first edit an existing stored procedure, at which point the "New window" button is enabled. Is there a way to get an empty window without first having to edit another ...
Score SQL Server / XBox 360
Paul Nielsen (MVP) - 24 Mar 2006 10:54 PM - 1 message
SQL Sentry is donating an XBox 360 for our Solution Contest at the Colorado PASS Camp May 17th. [link] Three finalists will present their SQL Server problem and their XBox 360 worthy solution. The winner will be selected by an all-participant vote. ...
Score Import/Export wizard
helpful sql - 24 Mar 2006 8:24 PM - 2 messages
Hi all,    I want to copy data from one table and insert it into a view using Import/Export wizard. But the wizard is not showing me my view in the dropdown list for destination. So is this possible? If so, how? ...
Score Help with counting Query
Bob and Sharon Hiller - 24 Mar 2006 7:50 PM - 12 messages
I am trying to find a query to count rows with multiple conditions. I have files which are suffixed with -R and then a number from 1 to 3 and then two digits 00-14. the field is char i.e.: ...
Score Query Help, Efficient Exclusion
JDP@Work - 24 Mar 2006 6:28 PM - 5 messages
I need to have in my staff_rank table each staffname and region, but it's OK to have a duplicate staffNames as long as the region is different. Please note that, I can't correct the problem of the same staffName having ...
Score sp_refreshview Error Handling
JSzymanski - 24 Mar 2006 6:12 PM - 2 messages
I am using the following code in a stored procedure to refresh a selected group of views (for which the underlying tables have changed):          SET XACT_ABORT OFF          EXECUTE @spErrNo = sp_refreshview @fullViewName ...
Score Weird problem with temp tables
Eric Caron - 24 Mar 2006 5:50 PM - 9 messages
Hi all, I'm using SQL Server 2000 and I have a strange problem with a temporary table I'm creating in a stored procedure.  I use the following code: SELECT * INTO #TempTable FROM tblUsers ALTER TABLE #TempTable ADD RecPosition INTEGER IDENTITY ...
Score Newbie question Local Temp Tables vs Global Temp Tables
Stephen K. Miyasato - 24 Mar 2006 5:32 PM - 5 messages
I'm trying to find the distinction between Local temp tables vs. Global Temp Tables. Seem that Global temp tables have greater persistence when using a stored procedure with a returning select statement. Question: Are any of the #tempLocalTable or ##tempGlobalTable accessible ...
Score counting child rows?
HockeyFan - 24 Mar 2006 4:53 PM - 2 messages
I've got a query where I have to find all messages for a particular topic, and then I need a count of all child messages for each message.  Here's what I have so far: ALTER PROCEDURE [dbo].[udForumTopicMessageByForumTopicID] ...
Score DTS Export Wizard
Elliot Rodriguez - 24 Mar 2006 4:31 PM - 2 messages
Is there a way for me to globally select "Delete rows in destination table" when performing an export via the Export Wizard? It is not obviously visible to me, and I have a great deal of tables. I've been clicking "Edit" for each one, and this isnt practical for obvious ...
Score Dynamic IDENTITY seed
Goran Djuranovic - 24 Mar 2006 4:10 PM - 14 messages
Hi all, Does anyone know if it is possible to set identity seed using a variable, and if not what is the alternative? I would not like to use Dynamic SQL. I cannot get any of the following to work. ...
Score moving a db from 2005 to 2000
Edie Richardson - 24 Mar 2006 4:01 PM - 4 messages
I have a vendor who uses sql server 2005 but we are currently using 2000 sp4. He has sent me a mdf,  a ldf file and a bak file.  I would like to get this on my ss2k server.  What is the best way to do this? ...
Score Rounding
Brian Shannon - 24 Mar 2006 3:57 PM - 3 messages
I am trying to round values to the nearest $5. I work in the casino industry and we offer patrons cashback on thier play. Let's say someone earns $42 cash back.  I need to send them an extra check ...
Score Populate Normalized Data!!!!
Vai2000 - 24 Mar 2006 3:53 PM - 3 messages
Hi All, I have a data file with delimiters that contains data for relational table. How can I populate these tables with the data file without writing much of code. The trick is these tables have Constraints PK, FK and identity fields. The ...
Score Get collation list
christof - 24 Mar 2006 3:49 PM - 5 messages
Is there a way do programmable get a Collation list from server? Tried this: [C# code] using Microsoft.SqlServer.Management.Smo; Server srv = ...; DataTable collations = srv.EnumCollations(); but it returns an empty DataTable, i wish to fetch it somehow. SELECT * ...
Score check field
js - 24 Mar 2006 3:29 PM - 4 messages
Hi, how to find out what table, field contain "mysearchtext" in side? Thanks a lot. ...
Score Deadlock help on single table
McGeeky - 24 Mar 2006 3:27 PM - 10 messages
I am experiencing a large volume of deadlocks with a stored procedure I have written. The stored procedure only ever accesses one table. First it performs a couple of selects to check if a record exists or not and if it ...
Score TSQL or CLR? Interested in hearing opinons...
Charlie@CBFC - 24 Mar 2006 2:44 PM - 5 messages
Thanks, Charlie ...
Score Which system table tells you if a column is primary key?
Charlie@CBFC - 24 Mar 2006 2:41 PM - 4 messages
Thanks Charlie ...
Score Table creation warning concern
Steven - 24 Mar 2006 2:41 PM - 7 messages
I am utilizing the June 2005 PPEL and I am logging exceptions to a SQL Server 2000 database. In the PPEL installation there is a script named LoggingDatabse.sql that creates the necessary table and stored procedure. When I execute this script I am getting the following warning: ...
Score How to delete records on dependent tables? Thank You.
Miguel Dias Moura - 24 Mar 2006 2:35 PM - 4 messages
Hello, I am creating my first procedures in SQL using SQL 2005. I have 3 tables, with the following columns: Surveys - [SurveyId](PK) and [SurveyName] Questions - [SurveyId](FK), [SurveyQuestionId](PK) and [SurveyQuestion] Answers - [SurveyQuestionId](FK), [SurveyAnswerId](PK) and [SurveyAnswer] Each survay can include various questions and each question can include ...
Score Exclude child nodes i Select
Senna - 24 Mar 2006 2:01 PM - 3 messages
Hi Have this code, [link], that I found at CodeProject.com. ([link]) To the Node table I have added a IsActive column, that you can see is being ...
Score LIKE and variables
Enric - 24 Mar 2006 11:54 AM - 6 messages
Dear all, I can't work out with this query: declare @var char(20) set @var = 'look%' select name from table where field like @var No return rows when there is a lot Any input or advice would be very appreciated. ...
Score DISTINCT OR GROUP BY
Savas Ates - 24 Mar 2006 11:33 AM - 7 messages
I have some records in my Sql Db. There are some duplicate record in my email and adsoyad fields Email                Adsoyad a@a.com        Savas ...
Score Cascading stock values?
Mike Owen - 24 Mar 2006 9:58 AM - 9 messages
Hi, I have a database containing products, the tables of which are basically as follows: table_PRODUCTS -->(products may or may not have colours) table_PRODUCT_Colours -->(colours may or may not have sizes) table_PRODUCT_Colour_Sizes - The tables currently hold stock values at all 3 levels, and the sum of ...
Score Best way to check a bunch of variables passed to a SP
Robert Bravery - 24 Mar 2006 9:27 AM - 3 messages
HI all, If I hav a SP like CREATE PROCEDURE addclaim @ctkey int, @headerid int, @cpkey int, @brkref varchar(25), @DET varchar(100), @Status tinyint, @peril int, @cause int, @resc int, @fault int, @polsection int, @Assid int AS What is the best way to check that a value is passed to each variable, and ...
Score read file and exec contents
Andre - 24 Mar 2006 6:29 AM - 4 messages
I have a text file that contains "create index" statements - thanks to those of you here who helped me get past my hurdles with this step earlier in the week. :) Now I need to read the file and execute it - basically execute the contents ...
Score Successor to SQL-DMO?
Neil W. - 24 Mar 2006 2:42 AM - 7 messages
What is now the officially sanctioned way of obtaining schema information in a program now that SQL-DMO is supposed to be old technology? ...
Score Greater than zero
Eric_Singapore - 24 Mar 2006 1:53 AM - 16 messages
Hi all, I have created a table and I need to make amendments to one of the attributes. The attribute is set to accept integers but now I have to change to accept only integers greater than zero. May I know how do I make this change? ...
Score How do I.......
Eric_Singapore - 24 Mar 2006 1:48 AM - 1 message
Anith Sen wrote: Thanks for your help -- Eric_Singapore ------------------------------------------------------------------------ Posted via [link] ------------------------------------------------------------------------ ...
Score Trouble in using bcp to get data into table for MS SQL 2005
SQL noob - 24 Mar 2006 1:37 AM - 6 messages
we are using microsoft SQL 2005 server, we are trying to put data.txt file into the server, the file we put in have been edited below, the three names of the column are written in the file. what we should use for the data type ...
Score Using Select and Convert in procedure..
Habibullah - 23 Mar 2006 11:34 PM - 3 messages
Hi. I can't figure this out.  I like to select all the record from Table_tbl and converting one field at the same time. Here are two separate statements: 1: Select * From Table_tbl 2: Select convert (decimal (5,2),strcost) from Table_tbl ...
Score sp_start_job
Tejas Parikh - 23 Mar 2006 10:53 PM - 2 messages
I am unable to use the @server_name param of this sp. I can do this exec msdb..sp_start_job @server_name='shanghai\shanghai1',@job_id='7C256C70-D64D-4C1F-8D98-CA44C51698FC' what I need to do is run this job on shanghai\shanghai1 instance from ...
Score error handling and transactions - speed question
Keith G Hicks - 23 Mar 2006 10:09 PM - 5 messages
I've been very carefully studying [link] recently. I went through it some time ago before I was very familiar with working in SQL and it was all sort of mysterious to me. Now I'm finding it to be very helpful. ...
Score Logshipping problem. need to do the below ASAP
Tejas Parikh - 23 Mar 2006 9:53 PM - 1 message
Hey. I've logshipping setup right now. What I want to do is look for I need to setup a job that would run every 5 minutes to look for 'Error: 3456, Severity: 21, State: 1' in the error log. ...
Score Can Kill Command undo changes outwith a transaction?
woodk - 23 Mar 2006 8:49 PM - 3 messages
In SQL 2000 I have a problem whereby it appears that a process successfully saved data (inserts followed by updates), hung, and when I killed the process some of the data disapeared. I had understood that only declared transactions would be rolled back, but in this case it appears that untransacted changes ...
Score Combine results into one field
Joey Martin - 23 Mar 2006 8:31 PM - 2 messages
If I do a basic query select * from grouping where code='12345' I get the results (fields are code,result) 12345     aaaaa 12345     assas 12345     f5fgh I NEED to get it as aaaaa,assas,f5fgh. Since code is all the same, I ...
Score OLEDB in .Net 2.0 web
David - 23 Mar 2006 7:38 PM - 2 messages
In my web page I am using the following OLE command to connect to a SQL 2005 db. Dim conFileData As OleDbConnection conFileData = New OleDbConnection("Provider=SQLNCLI;Server=Server01;Database=Filedata;Trusted_Connection=yes;") conFileData.Open() How can I change this Provider to run from a server (Server03) with SQL 2000 ...
Score SQL 2005 on X64 bit
ram - 23 Mar 2006 7:14 PM - 2 messages
I am facing run time issue with SQL 2005 SP1 on Windows 2003 SP1 X64. SQL returns error, saying class not registered when we call CoCreateInstance() ...
Score What is notification services and how can it help me?
Brian Henry - 23 Mar 2006 6:05 PM - 2 messages
We just had SQL Server 2005 installed on our SQL Cluster... and was wondering what do you guys use notification services for? what is it good for? and any comments on it? thanks! ...
Score Problems with Connection String - MS SQL Server 2005 Express - HELP
Mark Moss - 23 Mar 2006 5:50 PM - 1 message
HELP         I moved a database and application created in MS SQL Server 2000 to MS SQL 2005 Express.  And when I run the applications I am getting  'SQL Server does not exists or Access Denied' error. ...
Score Copying structure of table form one database to another
kevin.jonas - 23 Mar 2006 5:49 PM - 3 messages
I am wondering if there is a simple way, like a stored procudure or using some type of table object, to copy a table form one database to another.  Just the structure , index, triggers, I don't want the data. ...
Score Query Analyzer problem with NT login.
sqlapprentice - 23 Mar 2006 5:35 PM - 4 messages
Hello, My SQL Server is set to "mixed mode".  I am using TCPIP. I can logon to the server physically, but I can't do it remotely on my laptop from my Enterprise Manager or Query Analyzer.  I am able to ping the ...
Score Read XML > 8k in sql TEXT column?
Paul - 23 Mar 2006 5:29 PM - 4 messages
Hi, I have a SQL2k database that holds XML in a TEXT column because it is greater than 8k, I need to extract the value from a couple of fields in the XML. How can I do this? Examples would be great; I'm new to world of XML. ...
Score SQL 2005 File IO programming
Mark - 23 Mar 2006 5:11 PM - 6 messages
We would like to add some capablility in our backup routines to move, copy, and delete files after backups. For example: After the backup, copy the backup file to another server, then delete old backup files. We use MSSQL backups, SQL Litespeed, and red-gate software depending on the server. ...
Score select, a join with a count?
HockeyFan - 23 Mar 2006 5:09 PM - 2 messages
I've got 2 tables; basically, topics and messages. How do I list the topics and then the count for each topic? set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[udForumTopics]     @CompanyID int AS SELECT ...
Score Return records with the same social security number
Anonymous - 23 Mar 2006 5:07 PM - 3 messages
I have a table with FName, LName, SocialSecurity.  I want to return the records where the social security numbers are the same showing FName, LName, SocialSecurity. I did a count on SocialSecurity to find the numbers where there was more ...
Score Random selection of rows
Phil Hobgen - 23 Mar 2006 5:07 PM - 7 messages
Hi, I need to select a number of rows from a query result. EG I may want to return only 100 rows from a query that returns 500 rows. The rows returned must be distributed across the query result set. If the same query is run ...
Score Timeout in SQL2005
simonZ - 23 Mar 2006 3:48 PM - 3 messages
In managment studio of SQL server 2005 I often get the following error: Unable to modify table. Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. On the other hand in sql enterprise manager(sql2000) the same things works. ...
Score Data is truncated /SQL query help
Test Test - 23 Mar 2006 3:32 PM - 7 messages
Please help me to understand why the data is being truncated. Please run this code. If you notice, the final @select does not show all the names which are in the table. It is cutting off. (even though the length of ...
Score Using [ sp_getapplock ]
rmg66 - 23 Mar 2006 3:09 PM - 4 messages
I'm sorry if I'm being dense. But I don't quite understand how to use sp_getapplock. Is it supposed to lock access to any db object (e.g. a particular stored procedure) until it is unlocked? When I tested it. It didn't seeem to do what I expected.... ...
Score REQ: Bulk XML Update and Insert Performance Advice
Mark S. - 23 Mar 2006 3:03 PM - 2 messages
Hello, I've been asked to rebuild an app. The app in question is a real time stats engine. It uses C# to loop over each stat and send it to a SQL Server 2000 SP3 stored procedure. There the stat is parsed into it's different parts and ...
Score Cannot Add SQL Server 2005 Mobile to Pocket PC Project.
Dan Bass - 23 Mar 2006 2:59 PM - 2 messages
-- Installed -- Visual Studio 2005 (.Net 2.0) Sql Server 2005 Express Sql Server 2005 Mobile SDK I'm trying to add a "SQL Mobile Database" component to my Smart Device project through Visual Studio 2005. On one machine this works no problem (my laptop), but on my development ...
Score smalldatetime or integer
simonZ - 23 Mar 2006 2:42 PM - 12 messages
I have to create some statistics based on datetime entry. In my table I have datetime column, but all my entries for statistic are day base(I don't need hours, seconds or minutes). So, I decided to create another column where I'll put just date without ...
Score IF Update(@ColName) won't work...
Charlie@CBFC - 23 Mar 2006 2:39 PM - 3 messages
Hi: Inside a trigger I would like to check if a field changed using Update() function.  However, the field name will stored in a variable, but IF Update(@ColName) doesn't work.  Why won't Update() accept a variable ...
Score Index hints in a view.
Alexander Korol - 23 Mar 2006 2:16 PM - 2 messages
Hi SQL Server 2000 SP4 I am using view in my stored procedure. The view gets data from only one table. I can not use table directly due to some reasons. I would like to add an index hint to this table. Is View definition the only place for that? I ...
Score Storing result of Dynamic query to local variable
Charlie@CBFC - 23 Mar 2006 2:10 PM - 4 messages
Hi: Is there a way to store result of a dynamic query to a local variable?  For example, why doesn't this work? declare @var varchar (50) set @var = exec('select customerid from customers where customerid = ''ALFKI''') select @var ...
Score View prevents stored procedure from caching execution plan?
Alexander Korol - 23 Mar 2006 1:56 PM - 2 messages
Hello SQL Server 2000 SP4 According to the books View's execuion plan is recalculated each time the view is accessed. Does it mean that if stored procedure queries data from a view, possibly filtering output with WHERE clause its own execution plan will ...
Score Select statement for finding phone numbers
Robert Dufour - 23 Mar 2006 1:46 PM - 4 messages
The phone numbers (north american) could be written in the table in several formats ex. (514) 645-8865 or 1 (450) 658-1788 or 14506532345 etc. I think the best way to do a lookup is to look for a number that is made up ...
Score Help with Select Minimum Value
Stephen K. Miyasato - 23 Mar 2006 1:13 PM - 3 messages
I need help in doing a select statment with a minimum here is the statement CREATE TABLE [Test] ( [rIndex] [int] IDENTITY (1, 1) NOT NULL , [Defaul_] [int] NULL , [FilterType] [int] NULL , [ProtScr] [int] NULL , [ProtRank] [int] NULL , [Description] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , ...
Score About EM
Enric - 23 Mar 2006 12:55 PM - 3 messages
Dear all, A pair of questions: 1)Why 'dtproperties' table appears as user table in sysobjects table? 2)Is there any way for to expand all the object once for all when you have open EM at most top level? I mean, I've got 14 groups created and each of ...
Score Entreprise Manager behaviour
Enric - 23 Mar 2006 12:25 PM - 11 messages
Dear all, I've got the following scenario: -Got two EM instances running at the same time. The same view on the right for both, this is, Tables. From EM1 I create a table called T. After that I'm going to EM2 and refresh. ...
Score Could not find database ID 14. Database may not be activated yet or may be in transition.
ITALstudio S.p.A. - 23 Mar 2006 11:56 AM - 3 messages
Hi, I have dropped some databases of my application through Enterprise Manager. Then, I have run my application that try to read a dropped database's table and I receive the following error: "Could not find database ID 14. Database may not be ...
Score Service Broker - The right approach?
Christopher Quest - 23 Mar 2006 11:24 AM - 5 messages
I am working on a project that uses a modified version of the A.R.T.S. database at H.O. This contains data for each client located in a hierarchical location (I.e. Country\Region\City\Store\Client). I have code that can ...
Score Reg:Passing Parameter to Trigger
SivaprakashShanmugam - 23 Mar 2006 11:12 AM - 4 messages
Hello Is there any possibilities to pass parameters to Triggers if so How?. Siva. ...
Score Concatenation and NTEXT
Jono - 23 Mar 2006 10:49 AM - 3 messages
Hi everyone, I have a problem trying to update an NTEXT column by enclosing it between two strings, as shown in the SQL below: UPDATE MyTable SET NTextField = N'<pre>' + NTextField + N'</pre>' The error I get back is this: ...
Score Help on elapse time to return data ????
serge calderara - 23 Mar 2006 10:47 AM - 4 messages
Dear all, I have build an ASP.net application which calls different store procedure. When my customer request data from store procedure, I would like to display on the page, the time it takes to return data. How to do that ? ...
Score Scheduled job executing Stored procedures fails
news.esat.net - 23 Mar 2006 10:39 AM - 3 messages
Hi, I have 4 seperate stored procedures that if I run manually from Query Analyzer work fine.  Each one picks rows from a number of joined tables depending on a date criteria.  Each SP is exactly the same except for the ...
Score Activity Monitor
Tlink - 23 Mar 2006 10:29 AM - 10 messages
When I execute a task against my mssql 2005 server it remains visible in the activity monitor for up to 10 minutes (status = sleeping. open transactions = 0, command = awaiting command), I have tried and changed the commandtimeout = 10, reset the connectiontimeout and still it remains. It ...
Score Update the salary of each manager to be double the average salary of the employees he/she manages
satish - 23 Mar 2006 10:23 AM - 8 messages
create table employee(empid int,empname varchar(20),managerid int  not null, sal int) insert into employee values(1,'ranga',22,5000) insert into employee values(2,'satish',22,8000) insert into employee values(3,'sunil',11,4500) insert into employee values(4,'sridhar',22,2000) ...
Score Problem with SET QUOTED_IDENTIFIER ON
AMiha - 23 Mar 2006 10:13 AM - 6 messages
Hi, I am creating User defined function with SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO But function is created with QUOTED_IDENTIFIER  OFF and SET ANSI_NULLS OFF. What is wrong. Thanks ...
Score [FR/EN] How to make several hundreds of recording at the same time?
Alextophi - 23 Mar 2006 10:13 AM - 2 messages
FR -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- bonjour, J'effectue plusieurs enregistrements provenant de plusieurs serveurs dans une base SQL. Mon problème est que l'enregistrement écrit des données dans plusieurs tables et donc quand il y a plusieurs centaines d'enregistrements à la même heure les données sont mélangées dans ...
Score How do I.......
Eric_Singapore - 23 Mar 2006 10:01 AM - 2 messages
modify a new table name Table1 to include this condition:- This new table has an attribute( which is a primary key ) and it takes the value of another attibute from another table. The name of both attributes are the same. Furthermore, it must take the value whose other attibutes of the other table to be NOT NULL. ...
Score HELP!!!!!!!!!!!!!!
urgent - 23 Mar 2006 9:52 AM - 4 messages
please help me create the table for the data in the following data lines after this i am out of my wits to thing for what data type to use. because for everything i tried i got the error below the column name will be for the ...
Score Can i bypass a trigger
Mikael - 23 Mar 2006 9:48 AM - 6 messages
I have 2 tabels "realtime" and "historic" Im getting updates on "realtime" and a trigger transferes the data to "historic" if the some dates change. I've made an sp that can update "realtime" and "historic", and it is more ...
Score How to list all Triggers with SQL 2005 like sp_tables or sp_databases?
Andreas Klemt - 23 Mar 2006 9:16 AM - 6 messages
Hello, how can I list all Triggers like sp_tables or sp_databases? Thanks for any help in advance! Regards, Andreas Klemt ...
Score Use alias in sql statement
Jan Lorenz - 23 Mar 2006 9:13 AM - 5 messages
Hi, It's possible to use a alias name directly in a sql statement? Example:         SELECT Col1 * Col2 AS alias, alias * Col3 FROM table best regards Jan ...
Score Simple SQL syntax question ??
serge calderara - 23 Mar 2006 8:55 AM - 4 messages
Dear all, I have a store procedure which has as input parameter @MonthId (integer) Then in my database table I have a dateTime field. Then I need to exctract records where the Month part of the DataTime field correspond to @MonthId ...
Score MS SQL Server 2005 - How to add databases/users/etc.???
Noozer - 23 Mar 2006 7:49 AM - 4 messages
I've installed the MS VB Express and WebDev Express and subsequently have MS SQL Server 2005 installed. I'm at a complete loss as to how to access or configure this server. In the SQL Server configuration I can only see how to ...
Score Theory on composit key
Mikael - 23 Mar 2006 7:31 AM - 7 messages
I know that it is good practice not to use data as keys. Would one think of a smalldatetime as data ? My situation is that i collect historical information on financial instruments. I have a price table with a composit primary key of instumentId and ...
Score how to format datagrid coloumns header text
jaffar - 23 Mar 2006 7:13 AM - 2 messages
hi,      i am developing an appllication, in this appllication i am using datagrid . in this datagrid coloumns header text i want to change coloumn header text in vertically it means datagrid coloum header text is like this ...
Score Help on SQL syntax ???
serge calderara - 23 Mar 2006 6:48 AM - 5 messages
Dear all, I am using SQL 2000 with vs2003. I need to create a store procedure which get the LAST record which has been written in the database. What is teh way to get that record ? thnaks for your help ...
Score getting native error 18456 Error = login failed for user(username) when using BCP
RPK - 23 Mar 2006 5:53 AM - 4 messages
Hi , can any one help in exporting data to a flat file by using BCP, iam trying to use BCP but iam getting following error Error : native error 18456  Error = login failed for user when using BCP thanks well in advance ...
Score OSQL returns error code of 1 - intermittently
Robert Wheadon - 23 Mar 2006 5:10 AM - 4 messages
Hello, I've written an program that runs OSQL to set up a database.   I got a weird situation yesterday where OSQL returns an error level of 1 and didn't generate any output file at all.   The command I use is: ...
Score Next/Prev record
William Stacey [MVP] - 23 Mar 2006 3:53 AM - 4 messages
If you have an identity column (i.e. 1-N) and you have 5, what is the most efficent query to get the next (and prev) row?  Gaps could happen so there may not be a 6, but the next in order may be 8 for example.  TIA ...
Score How do I create a new stored procedure?
needin4mation - 23 Mar 2006 3:46 AM - 2 messages
Hi, I am using SQL Server 2005 Express trying to learn to write a stored procedure.  In my database, I right-clicked on progammability -> stored procedures -> new stored procedure.  I put in my procedure, hit execute, but it just keeps saying: ...
Score NAN equivalent
Dan - 23 Mar 2006 3:37 AM - 3 messages
I need to be able to check if the first 4 characters in a varchar field are a valid int. Is there anything similar to a NAN() function in TSQL that I could use, or can anyone think of another way to do this? ...
Score Convert Int to String and add to another String
Vear - 23 Mar 2006 3:33 AM - 3 messages
Hi, I have a SP where I grab a value from an Identity field and then I want to convert it to a String and add it to another string. Only the @lname stores in the @CustNum. From what I understand STR should ...
Score simple SQL clause fails
Paul Pedersen - 23 Mar 2006 2:59 AM - 3 messages
Can anyone tell me what's wrong in this portion of a SQL statement? The relevant fields are simple integers and char(1) This works fine: CONVERT(SMALLINT, SUM(CASE WHEN a.field1 = 1 AND a.field2 = 0 THEN 1 ELSE 0 ...
Score SQL Job behavior...Not Quit on Failure?
Atkins - 23 Mar 2006 2:37 AM - 3 messages
I have a sql job that executes a stored procedure.  The procedure just iterates through a cursor and performs an update or insert and this doesn't occur within a transaction. If an insert or update fails will the job step quit on that first ...
Score Trigger: When deleting more then 1 row it doesn't trigger
Andreas Klemt - 23 Mar 2006 2:25 AM - 3 messages
Hello, I have this ALTER TRIGGER [mytableDelete] ON [dbo].[mytable] FOR DELETE AS SET NOCOUNT ON DECLARE @user_id int SELECT @user_id=user_id FROM deleted DELETE FROM users WHERE user_id = @pa_id Now this works fine when I only delete one row like this ...
Score cross-db update sp peformance
John A Grandy - 23 Mar 2006 2:01 AM - 1 message
Two dbs on same instance : Products.dbo.Items.itemId int PK Search.dbo.Items.itemId int PK For the following sproc create proc [dbo].[usp_UpdateItemDateCreated] as update Search.dbo.Items set itemDateCreated = Products.itemDateCreated from Products.dbo.Items pi join Search.dbo.Items si on ...
Score Test for group
MAF - 23 Mar 2006 2:01 AM - 1 message
How can I test to see if a group exists? if exists(MyGroup) GRANT SELECT ON [dbo].[tablename] TO MyGroup ...
Score Batch execute of SQL script from ADO.Net
Marcus - 23 Mar 2006 1:30 AM - 2 messages
I have a VB.Net application that needs to create about 5 stored procedures and a couple of functions on SQL Server 2005 Express. Currently I can execute all of them in one window of Sql Server Management Studio, just separate each of them with a "GO" statement. Is ...
Score how to view data whilst in an uncompleted transaction, from outside the transaction?
mag1kus - 23 Mar 2006 1:21 AM - 3 messages
Hi everyone, I was hioping to obtain some help with viewing sql data whilst within a transaction, from OUTSIDE the transaction itself. For example, if i do the following steps: 1) -- Do this in Query Analyzer session 1 window -- Note: there is no commit transaction below ...
Score Need help reinstalling Internet Exploiter
Mr. Nobody - 23 Mar 2006 12:47 AM - 1 message
Hey all, I was wondering if anyone could help me reinstall IE. I tried uninstalling it from "Add/Remove Windows Components" but it wants the Wind. XP disk, which i dont have. I need IE specifically to install my dsl connection. Any suggestions? ...
Ink
Next »