General Question
Jul 26, 2007
hi...i would like to know best practice when assigning a value to a variable
example below
set
or
select
declare @var1 varchar(25)
set @var1='abc'
select @var1='abc'
to me
set is implicit
select implies conditions
i see both used all over the place here at my new company....
so witch is better practice
tks
MJ
View 6 Replies
ADVERTISEMENT
Oct 19, 2005
The following is my code. What I am trying to do is find all the students a teacher as assessed during a give time. Then find out which assessment was done the most recently. After that I will then be aggregating those results. I have never written any pl/sql or T-SQL... heck I don't even know what to call it!The first sql command is doing what I want it to. I can only assume the cursor is working correctly. Any help would be greatly appreciated.BryanALTER procedure Domain@UserID numeric,@StartDate datetime,@EndDate datetime
AS-- Variable DeclerationDECLARE @SessionID varchar(1000)DECLARE @EachSessionID numeric
--Cursor to find all Children that the teacher has assessed for the given timeDECLARE ChildID_cursor CURSORFORSELECT DISTINCT childID FROM capsessionWHERE userid = @UserIDAND sessiondate BETWEEN @StartDate AND @EndDate-- looping through all Children to find there most recent assessment.OPEN ChildID_cursorDECLARE @ChildID numeric FETCH NEXT FROM ChildID_cursor INTO @ChildIDWHILE (@@FETCH_STATUS <> -1)BEGIN IF (@@FETCH_STATUS <> -2) BEGIN DECLARE SessionID_cursor CURSOR FOR SELECT TOP 1 CAPSessionID FROM CapSession WHERE (ChildID = @ChildID) AND (SessionDate BETWEEN @StartDate AND @EndDate) ORDER BY SessionDate DESC END FETCH NEXT FROM ChildID_cursor INTO @ChildIDENDCLOSE ChildID_cursor
OPEN SessionID_cursorFETCH NEXT FROM SessionID_cursor into @EachSessionID SET @SessionID = ''WHILE (@@FETCH_STATUS <> -1)BEGIN IF (@@FETCH_STATUS <> -2) BEGIN SET @SessionID = @SessionID + @EachSessionID+ ',' END FETCH NEXT FROM ChildID_cursor INTO @ChildIDENDCLOSE SessionID_cursorRETURN @EachSessionID
View 3 Replies
View Related
May 30, 2008
Hi, I wanna know if one has to undergo the 'sql video tutorials' on this website before trying to understand data access tutorials, again on this site.
Are the two related by any chance. Also I am not able to find the customer database files he has created in tutorial # 5, dumb to ask, but what to do?,...so anyone willing to shed light!!!
View 2 Replies
View Related
Jan 12, 2003
Hello everyone,
as you might have seen, I'm a total newbie to this Site and M$ SQL.
I browsed the forum to see if there are already matching answers to my question, with no success.
My question:
As a MySQL & PHP user I ask myself if there is a possibility to use M$ SQL the way I use MySQL and PHP!?
Is there a way to generate dynamic websites with M$ SQL 2000 and a webserver running PHP sources?
A brief yes or no would really help me, if you have any links or resources on this topic, I'd be glad to hear about it.
Thanks
Tom
View 2 Replies
View Related
Mar 1, 1999
I get the error "General SQL Error" when reading or writing to a memo field in Sql Server through a frontend build in Delphi 4.
I'm Using the latest BDE.
I have recently installed this onto a NT enviroment in the same manner as my own enviroment but get the error message above.
On my own enviroment and a friends enviroment I do not get any errors.
Can someone please give me some help on this or a direction to run in ?
Thanks
Dave.
View 1 Replies
View Related
Apr 3, 2008
1. What is the SQL error you receive when you try to fetch data from a cursor after it has run out of data?
2. After a SQL statement is executed, what does a negative value in the SQLCODE variable indicate?
View 7 Replies
View Related
Sep 26, 2004
Hi, folks. I've a production SQL machine with more than 20 users making transactions 24 hrs in 6 days a week. I've only Sunday for maintenance. The server has fixed 2 GB RAM allocation for SQL. Is it good to Restart SQL ( or machine) to clear the Buffer-Cache( or is it good to keep the cache) .... :rolleyes:
Howdy!
View 3 Replies
View Related
Mar 16, 2006
:eek: I am not going to lie, I am taking a DB course and am finding it extremely difficult to understand. :o
We are doing Relational DB & ER modeling as well as table normalization.
I only have 1 hour to take an upcoming and know I will score poor on my own.
Anyone want to help me out with my quiz?
I can post the Q's here.
Thanks much
View 14 Replies
View Related
May 3, 2004
Hi! How do you query an entire db for a value?
I know how to do table queries from the SQL Analyzer, but not a full DB search.
Like, if I wanted to find a value '137.51 in a DB, what would I use?
Many thanks!
JJ
View 1 Replies
View Related
Apr 28, 2008
I'm not impressed with the speed/quality of responses from this forum...
Can anybody recommend a more active forum?
View 20 Replies
View Related
Oct 5, 2007
Hi,
is there a search function in MS SQL server 2005 to search for a name of a table or a name of field or entry in a field?
what/how should be the fastest way to do it?
thank you
View 4 Replies
View Related
Mar 11, 2008
Maximum Number of rows allowed in sql server 2005 tables ?
Maximum Number of columns allowed in sql server 2005 tables ?
What are all the built in string functions can be allowed for 'TEXT' DataType in sql server 2005?
View 1 Replies
View Related
Aug 3, 2005
Before I go into specifics, this is my problem. I've have a tablethat gets updated with large amounts of data on a monthly basis.Sometimes (rarely) identical rows of data are on one months import thatalready exist from the previous month. I can identify these rows from acombination of two fields (sampleID and testname).My question is this. Would it be an appropriate 'fix' if I created anew 'formula' field on the table comprising of a concatentation ofthese two fields and then made that an index field (no duplicates)? Myguess would be that if we then tried to import a record with a sampleIDand testname that already existed, then the import for that recordwould simply fail.Would this work? Is there a better way? My background is more withAccess so apologies if I'm not using the right terminology.Simon Harris
View 4 Replies
View Related
Jul 27, 2007
Is comp.databases.ms-sqlserver more active thanmicrosoft.public.sqlserver.server, or is it the other way around??Which NG is better for general and 'learning SQL 2005' types ofquestions??Thank you, Tom
View 2 Replies
View Related
Jul 20, 2005
New to using databases that are NOT Access. New to MS SQL Server. I'dlike help understanding some concepts.Firstly, I'd like to know how to connect to a database using MS SQLServer on a remote web server using Windows XP; I know the IP and havethe username and password to connect...but what program do I use?Suggestions, appreciated.Secondly, I'd like to make changes to the remote database - anyonesuggest programs to use?Regards,OZ
View 1 Replies
View Related
Mar 28, 2006
I have a general question about transactions and commands that are replicated in a Transactional replication.
My screen shot says:
A total of 5 transaction(s) with 85 command(s) were delivered.
I know what a transaction is, but what is a command?
I am assuming a transaction is
begintrans
committrans, correct?
View 4 Replies
View Related
Sep 21, 2006
I am currently upgrading my companies database from 6.5 to 2000. Including the replication. I am curious about something. Currently we are using the commands in 6.5 to do the replication instead of stored procedures. (except for one table that requires custome filters). When I reestablished replication on 2000, the default is to create stored procs on the subscribers to hande the replication. (sp_MSins_tablename). My question whether anybody knows why it defaults to using sp's? Is there a reason or is that just the way it is. I want to know if using sp's is better than just sing the commands before I change my setup.
Thanks for any responses.
Johnny
View 3 Replies
View Related
Jul 16, 2007
Hello,
Can someone please answer the following questions:
1) Am I correct that SSRS 2005 can access a remote data source on SQL Server 2000? (this one I'm pretty sure about). I'm also trying to determine whether I can move up to SSRS 2008 when it is released and keep running all the same report types against SQL 2000.
2) Where is the bulk of the reporting services calculations performed (e.g. NOT the database query itself)? The Reporter Server? Or the Reporter Server Database?
3) Is it advisable to have the Report Server and Report Server Database on the same server? How do people typically handle this?
4) Is it advisable to have the Report Server and the Datasource database on the same server?
Thanks!
Michael
View 4 Replies
View Related
Apr 19, 2007
I have a website. It is a SAS Site. It has a structure similar to
tbClient (ID, Username, password)
tbData (ID, ClientID, info)
tbDatax(ID, tbDataID, info)
tbDatay(ID, tbDataXID, info)
This is a reporting nightmare for me. I Ihave a sollution, but i was wondering if SRS has an out of the box sollution or if anyone knows of an out of the box sollution.
It is a reporting nightmare because clients want to be able to create reports out of the system, but I can't let them see other clients data.
My sollution is give them a username CLientA
They log into The database with CLientA login
I have views that mask the data by enforcing all of the relationships through the view.
create view vutbDatax as
Select tbDatax.*
from tbDataX
Inner Join tbData on tbData.ID = tbDataX.tbDataID
Inner Join tbClient on tbClient.ID = tbDataX.ClientID
where tbCLient.Username = User
User is a Database function that returns me the Username they logged into the database as.
Imagine doing that for 100 views. And managing the security on it. I have done it and it is in the process of testing right now but Does anyone have a better sollution.
View 1 Replies
View Related
Feb 29, 2008
Hi, I've got the query below which works as needed, but it performs the same inner select twice at present. What is the best way of eliminating the second evaluation of the inner select statement?
SELECT TOP 1 condition FROM
(SELECT condition, COUNT(condition) AS total FROM [JCM].[dbo].[jcmresults] GROUP BY condition)
WHERE total = (SELECT MIN(total) FROM
(SELECT condition, COUNT(condition) AS total FROM [JCM].[dbo].[jcmresults] GROUP BY condition))
Thanks,
Andrew
View 5 Replies
View Related
Apr 14, 2008
I have a website that is probably going to hold a sizable amount of data. The data will be specific to groups of users based on login credentials. Would it be more efficient to create a whole new database for each group of users, or create new tables for the groups in the existing database?
Any thoughts on the topic would be appreciated.
Thanks
View 3 Replies
View Related
Jun 16, 2008
If I have a foriegn Key stored in a primary table, are triggers used to automate routines in the foreign table when ever the foreign key is changed.
Is there a forum reference with practicle examples of where to use triggers?
View 3 Replies
View Related
Apr 20, 2005
Hello.
I'm running into a rather intermittent problem when a search query is run on an ASP.Net web application.
The error is 'General Network Error' Check your Network Documentation...
As I said, it doesn't happen everytime which leads me to beleive that there is a problem with the database connection
There's probably no more than 50-60 max users hitting the app at any one time.
Anybody familiar with this?
View 1 Replies
View Related
Feb 24, 2006
hi guys
i am developing my application on framework 1.1 on asp .net
i am trying to connect to sql server 2005 but it gives me error like general network error check your network documentation.
does any one know how to solve this error then pl reply fast
View 1 Replies
View Related
Mar 8, 2006
Hi all,
I'm new to ASP2.0 development (not new to programming though) and have been grappling with general paradigm questions.
So far, I'm using a SQL database to store my applications data. On UI front, I've been using the SQLDataSource in combination with a gridview control. VS2005 thus far has been really easy to use when it comes to these controls. However, I see myself having to know knowledge of the database in UI layer which screams as a classical mistake.
The right thing to do seems to be to have an intermediate layer, an object model, abstracting the database. However, if I do create an object model representing tables in my database and then expose these to the UI layer, I lose the ability to easily display data in my gridview (i will no longer be using a sqldatasource.
So, after much run around my question is this, what is the preferred paradigm when programming applications for ASP.NET 2.0 and can you still use the nicities offered by VS2005?
Thanks
-Aleem
View 1 Replies
View Related
Dec 26, 2001
Over the course of many weeks the frequency of the following error has been occurring. I have been trouble shooting this problem since I started with the company some 3 weeks ago and I am just stumped.
I'm running SQL7/SP3 on NT4 with current SPs and hotfixes. My default library is NamedPipes with an alias allowed for TCP/IP.
Any help or leads would be appreciated. I've checked for everything the MS KB suggests and it still hasn't resolved my problem!
example of the error:
Microsoft OLE DB Provider for SQL Server error '80004005'
[DBMSSOCN]General network error. Check your network documentation.
/dir/file.asp, line 29
THANKS!
Kim
View 6 Replies
View Related
Jul 2, 2006
Hi
Would you say that it's ok for a web site code to make ALL of it's access to a db through SP and views? And I mean everything including inserting new records and updating others with no use with SQL in the code.
The advantage would be very strict control over the access, but in order to achieve this it would take many many SP and views to cover all types of actions, can you think about a disadvantage except all the work creating those SP?? what about the server resources and performance? how demanding it would be?
Thanks,
Inon.
View 7 Replies
View Related
Jan 3, 2008
let me explain the scenario first
say table1 has columns col1, col2 and col3
where col1 and col2 together is PK
and col1 is same for for entire table and col2 is unique (well some may get doubt why to use col+col2 for pk when col2 alone is unique, to clarify this doubt, we have two dbs where in one db col1 does not repeat (in other words there are multiple dbs created based on this col1) and in other db it repeats (all dbs merged together))
sample data
col1--col2
==========
a--1
a--2
a--3
a--4
a--5
a--6
a--7
.
.
. so on
now my question, does both of the below queries takes same time
ex1:
select * from tabel1
select * from tabel1 where col1 = 'a'
in other words, does WHERE clause has any effect in performance when the column used in the query will always the same value with what it is compared?
does it has any effect when i join also?
ex2:
select a.*
from tabel1
inner join tabel2 a
on a.col1 = b.col1
and a.col2 = b.col2
select a.*
from tabel1
inner join tabel2 a
on a.col2 = b.col2 -- note: col1 is not used in join
and please explain how it is same/different
View 5 Replies
View Related
Jul 28, 2005
Please help!Getting this error intermittently:System.Data.SqlClient.SqlException: Timeout expired. The timeout periodelapsed prior to completion of the operation or the server is notresponding. at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehaviorcmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() After getting a fair number of these errors I get this one also:System.Data.SqlClient.SqlException: General network error. Check yournetwork documentation. at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehaviorcmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() SQL connection pooling is turned off. All sql parameters passed to thestored procedure and all the data types are correct.*** Sent via Developersdex http://www.developersdex.com ***
View 11 Replies
View Related
Mar 14, 2006
This is a very general quastion.....I regularily take data extracts from a SQL server database drop them inexcel and run a macro on the data.The macro does nothing more complicated than loops, addition,subtraction and remeber the changing value of a declared variable.It works perfectly, but is constrained by the number of rows in excel.I want to investigate the possibilty doing the calculations in the SQLtables. (All the data is contained within one table).What is the best way to approach this problem.i.e. can I get my excel macro to link to the Table and if not, whatother solutions are avialable to me.Regards,Ciarán
View 2 Replies
View Related
Jul 20, 2005
HeyI need to store something a little different in a DB and I was hoping one ofyou guys might be able to help me.Basically it represents a 'world'. I have an initial state and then I getinfo like this...27/11/03 17:21 Mary is born27/11/03 17:21 Dave is born27/11/03 17:22 Sean is born27/11/03 17:23 Peter dies27/11/03 17:23 Fred is bornI need to be able to run querys like this...How many people are alive at 27/11/03 17:22Who was born between 27/11/03 17:22 and 27/11/03 17:23etc.Problem is, I'm going to have hundres of 'world's each with thousands ofentrys.All help is appreciated :)TnxNaomi
View 2 Replies
View Related
Jul 20, 2005
Hi all,I'm getting the above error in Delphi 4 when attempting to connect aTDatabase component to an MS Access table. I am following the belowinstructions:Database1.DatabaseName:='tryDB';Database1.DriverName:=MSACCESS;Database1.LoginPromt:=false;Database1.Params.Clear;Database1.Params.Add('DATABASE NAME=D:Projectspattern.mdb');Database1.Connected:=true;TDBGrid.DataSource:=DataSource1;DataSource1.DataSet:=Table1;Table1.DatabaseName:='tryDB';Table1.Active:=true;Any help would be appreciated.TIA,TJ
View 2 Replies
View Related
Jul 20, 2005
I am running on Win2k, SQL Server 2000 (sp3), MDAC 2.8 and using aTCP/IP client connection.I get this error when attempting to restore a database.[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead(WrapperRead()).[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error.Check your network documentation.Does anybody know how to resolve this issue?Thanks
View 3 Replies
View Related