I'm working on an mini intranet site for a "University" type style. I have a table called "events" which stores information. One of my columns is "eventRSVP" which stores the employees ID's who click on the button, separated by a comma.
example:
Quote: 1751,2179,1371,2314,1778,702,1607,798,2097 Would it be better to create a new table called something like "event_jn" and it has 3 columns.
I'm also redoing our whole intranet and would be doing a lot of these similar type id linking. So my other question is, the more tables I have, is it going to slow down the response time?
in Global.asax.vb (Application_Start section) and then in the in the webforms we use
Dim con As New SqlClient.SqlConnection con = New SqlClient.SqlConnection(Application("conn")) con.Open() ...... ...... con.close()
(Each user has their own sql database that they connect to using the same scripts.)
The question is: When many users are logged on at the same time, will the use of Application.Contents be a safe way to connect to each users own database or is there a possibility that users suddenly will try to establish a connection to a database that is not their own?
Scenario: User1 logs in at 10:00 and establish a connection to his own database. At 10:05 User2 logs on and establish a connection to his database since Global.asax.vb is run again. Will User1 now use User2's connection so that he is actually woking on User2's database?
Is there a better/safer way to do this connection in Global.asax.vb ?
Dear Since my other threads concerning my question weren't clearly answered to me I'm starting again: I want to store musclegroups,musclecategories and muscles in different languages, please have a look at the proposal below and tell me if I'm on the right way
was hoping someone couild provide some insight into a problem I'm trying to solve.
I have a table called SEARCHCRITERIA. It consists of a USERID column and a CRITERIA column. Users will be able to search for other users based on a set of criteria. There are 5 total criteria a user can choose. They can choose as few as none or all five. I'd like to store the criteria chosen as a single number in the SEARCHCRITERIA table. Then use a function to parse out the criteria. For example:
CRITERIAID CRITERIA CRITERIAVALUE 1 AGE 2 2 SEX 4 3 GRADE 8 4 LOCALE 16 5 REGION 32
A user performs a search based on AGE, SEX, and LOCALE. I would then store the value 22 (the sum of 2, 4, and 16) in the SEARCH table. I would then need a function to pull out the three individual values.
Daily it will come upto 300 records. So for 100 days 300*100 records.How to store the records feasibly in database?How to define table to store records for above example?
Hi There This is probably realy simple but since im still a newbie some help would be appreciated. I have a listbox bound to an sqldatasource which has names of people from my sql database employeeDetails table. I simply want to allow someone to select to select multiple names and insert them into another field in my database. I have this bit workng, ie they can select multiple people on the list, it does insert, however only the first selected name, not the others.Can you please help me out Kind Regads Dan
name age weightaaa 23 50bbb 23 60ccc 22 70ddd 24 20 eee 22 30i need the output that calculate the sum of weight group by name input : age limit ex: 22 - 23 output : age total weight 23 11022 100 this output must stored in a sql declared variable for some other further process .
Sorry for the confusing subject. Here's what im doing:I have a table of products. Products have N categories andsubcategories. Right now its 4. But there could be more down theline so it needs to be extensible.So ive created a product table. Then a category table that has manycategories of products, of which a product can belong to N number ofthese categories. Finally a ProductCategory "match" table.This is pretty straigth forward. But im getting confused as to how towrite views/sprocs to pull out rows of products that list all theproducts categories as columns in a single query view.For example:lets say productId 1 is Cap'n Crunch cereal. It is in 3 categories:Cereal, Food for Kids, Crunchy food, and Boxed.So we have:Product----------------1 Capn CrunchCategories-----------------1 Cereal2 Food for Kids3 Crunchy food4 BoxedProductCategories------------------1 11 21 31 4How do I go about writing a query that returns a single result set fora view or data set (for use in a GridView control) where I would havethe following result:Product results---------------------------------ProductId ProductName Category 1 Category 2Category 3 Category N ...------------------------------------------------------------------------1 Capn Crunch Cereal Food for Kids Crunchy foodBoxedAm I just thinking about this all wrong? Sure seems like it.Cheers,Will
<usualDisclaimer>Please forgive me if this is in the wrong group, and if so,what is the right group.</usualDisclaimer>Let me start off by first saying im a newb. Ok, with that out of the way Iam trying really hard and boy have I learned a lot in the last little whilebut I have a question i just can't seem to find a good answer to.Lets say i have a table that simply stores how many times someone has loggedinto a webpage. Is it better to store each login as a new record then countthe records or is it better to simply have one record that updates the totalvalue by incrementing that one field. I have read all manner of articlesand some say one way is better vs. the other but what I can't find is why?If I knew why one way was better than another then I could make and educateddecision and choose the best way that is right for me. Is updating more orless expensive then inserting? Does it matter and is a relevant question?And before anyone comments on my use of all uppercase letters for my tablename I do this so that my table names stand out within the sql serverenterprise manager. In other words system tables are lowercase and mytables are uppercase. People always seem to give me crap for this but neverback it up with a good explanation so far as I can tell its personalpreference? Am I wrong?CREATE TABLE USER_METRICS(-- here i can select all the records and count them up.ID INT IDENTITY(1,1) PRIMARY KEY,Email VARCHAR(250));-- Or this?CREATE TABLE USER_METRICS(-- and of course here can i simply retrieve the value of Total_LoginsID INT IDENTITY(1,1) PRIMARY KEY,Email VARCHAR(250) NOT NULL,Total_Logins INT);Regards,Muhd
Hello DBA's i use this proc to insert & update the records in the databse update works good untill i change the user id. userid can be changed where adminuserid is the IDENTITY coulmn in the table.ALTER PROCEDURE [dbo].[spinsertusers] -- Add the parameters for the stored procedure here @adminuserid varchar(36), @userid varchar(15), @fname varchar(25), @mname varchar(25), @lname varchar(25), @password varchar(15), @address1 varchar(255), @address2 varchar(255), @postcode varchar(15), @cityidentity varchar(36), @dob smalldatetime , @email varchar(50), @crtduser varchar(36), @crtdon datetime, @isactive char(4), @mode char(10), @reccount INT output AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; DECLARE @Count INT -- Insert statements for procedure here IF (@mode='insert') SET @Count=(SELECT COUNT(*) FROM adminusermaster WHERE userid=@userid) IF @count=0 --Inserting the Records BEGIN INSERT INTO [school].[dbo].[AdminUserMaster] ([AdminUserIdentity] ,[FirstName] ,[MiddleName] ,[LastName] ,[UserID] ,[Password] ,[Address1] ,[Address2] ,[PostCode] ,[CityIdentity] ,[DOB] , ,[CreatedBy] ,[CreatedOn] ,[IsActive]) VALUES ( @adminuserid , @fname , @mname , @lname , @userid , @password, @address1, @address2, @postcode, @cityidentity , @dob, @email, @crtduser, @crtdon , @isactive ) SET @reccount=2 return @reccount END
-- End of Query IF (@mode='update')
SET @Count=(SELECT COUNT(*) FROM adminusermaster WHERE userid=@userid) IF @Count=1 --Query for Update the Records BEGIN update AdminUserMaster set [FirstName]=@fname , [MiddleName] =@mname, [LastName]=@lname, [userid]=@userid , [Address1]=@address1, [Address2]=@address2, [PostCode]=@postcode, [CityIdentity]=@cityidentity, [DOB]=@dob, =@email, ModifiedBy=@crtduser , ModifiedOn=@crtdon , isactive='Y' where AdminUserIdentity= @adminuserid set @reccount=3 return @reccount END
]First of all here is how i created my SQL database and established a connection in visual studio 05. I go into the server explorer and right click on the data connections node and and select "create new SQL database". A window then prompts me for a server name and data base name. Under server name I write "localhostSQLEXPRESS" and under data base name I put in whatever. This totally worked and the database was asigned the extension of .DBO I can now insert, select and delete information with some simple ADO coding. The only problem is that using this method makes it seamingly impossible to FTP my database onto my host server. I am aware that I can create a data base in the APP folder by simply right clicking it and selecting " new database". This would simplify the deploying process but I cant seem to establish a connection this way. Ive also noticed that when I use this method that it saves it as a .MDF instead of a .DBO. What is the difference? Why does my .DBO work but not my .MDF in my app folder? Im so confused over this issue that I am problably not even asking the right question. Bottom line is that I have a small web application with a .dbo database that works wonderfully in my isolated visual studio environment and I need a solution to deploy it on the world wide web. Please help with any information I would be very thankfull.
I am not an expert with sp. I am trying to pass the column name as a parameter but I get the following error "Must declare the variable '@strColumnName'."
ALTER PROCEDURE dbo.TempGetDataForDropDown ( @strColumnNamenvarchar (50) ) as
Hi all, I've recently created a shopping cart system that uses SQL Server on the backend. The shopping cart will add a record to a table called CartEvents each time anything happens, like view item, update, delete etc. anyhow, the site has been up for about a week now and that particular table has about 4200 records already, I project tens of thousands of records in that table, so how many records is too many records? Whats your experience with tables that have hundreds of thousands of records? How many records can SQL server handle and still perform well?
Im using windows xp sp2 and MS Sql server 2005 enterprise edition may b and im also havin sql server express previously when i installed sql server express it took server name on its own and i used to run queries using AdventureWorks database.. Recently i formated my desktop and again installed both the versions im having but neither is taking server name.. and i dint noticed what was the server name before.. im a student home user i just hav to query on adventurework databases on the same computer i cant afford to buy any servers.. so can anyone tell me how can i configure sql so that i can query !
I've been writing a few sql queries over the past few days, and would like to know what the difference is between:
website is null
website like ''
Becasue if they mean different things i want to know how to look them both up at the same time. Obv im after data that is blank or has nothing written in it.
I am trying to run an sql query with a function in SQL SERVER MANAGEMENT STUDIO and am getting the following error.
Msg 207, Level 16, State 1, Line 9 Invalid column name 'UserID'.
here is my Query ----------------- USE vportal4vsearch GO CREATE FUNCTION dbo.ConcatUserGroups(@UserID int) RETURNS VARCHAR(8000) AS BEGIN DECLARE @groupname Varchar(2000) SELECT @groupname = COALESCE(u.group_name + ', ', '') + CONVERT(varchar(20), u.group_name) FROMdbo.[user] A JOIN dbo.UserGroup_combo UG ON UG.ug_userID = a.USER_ID JOIN dbo.usergroup U ON UG.ug_groupID = u.group_ID WHEREA.USER_ID = @UserID ORDER BY U.GROUP_NAME
RETURN @groupname END GO SELECT user_ID, user_Firstname, user_Lastname, user_Email, Username = (Case When user_Username = ' ' or user_username is Null then 'None' else User_Username end), user_creationdate, Active = (Case When user_Active = 1 then 'Yes' else 'No' end), dbo.ConcatUserGroups(UserID), TheatreCode = (Case When User_TheaterCode = ' ' or User_TheaterCode is Null then 'N/A' else User_TheaterCode end), JobTitle = (Case When user_JobTitle = ' ' or User_Jobtitle is Null then 'N/A' else User_Jobtitle end) FROM [user] GO DROP FUNCTION dbo.ConcatUserGroups GO
Private Sub pulllikehell() Dim cn As SqlCeConnection Dim rda As SqlCeRemoteDataAccess = Nothing Dim sqlEngine As SqlCeEngine
Try
' Create database if it doesn't already exist If (Not File.Exists("My DocumentsORDER.sdf")) Then sqlEngine = New SqlCeEngine sqlEngine.LocalConnectionString = "Data Source=My DocumentsORDER.sdf;"
sqlEngine.CreateDatabase() sqlEngine.Dispose() Else ' Open the connection to the database cn = New SqlCeConnection("Data Source=My Documents" & _ "ORDER.sdf:") cn.Open() Dim cmd As SqlCeCommand = cn.CreateCommand()
' Drop the FieldMemos table cmd.CommandText = "DROP TABLE STAFF" cmd.ExecuteNonQuery()
' Close the connection
End If
' Instantiate the RDA Object rda = New SqlCeRemoteDataAccess ' Connection String to the SQL Server. Dim remoteConnectString As String = "Provider=SQLOLEDB;" & _ "Data Source=KANGALERT/SQLEXPRESS;" & _ "Initial Catalog=ORDER;"
rda.Pull("STAFF", "Select * from STAFF", remoteConnectString, _ RdaTrackOption.TrackingOnWithIndexes) MsgBox("ok")
Catch sqlex As SqlCeException Dim sqlError As SqlCeError For Each sqlError In sqlex.Errors MessageBox.Show(sqlError.Message) Next Catch ex As Exception MessageBox.Show(ex.Message) Finally rda.Dispose() End Try
End Sub
[/CODE]
computer server name is kangalert
and got 2 sqlservice run in my pc, SQLEXPRESS and MSSQLSERVER
I have a query that must return information for an invoice. It is not straight forward though. Some things need to be displayed from the if something else is happening... For example...declare @id int declare @chargeid int set @id = 1 set @chargeid = 9
declare @pp bit, @pages int, @pagefee money, @pagecharge money set @pp = (select perpage from tblmainfees where mainfeesid = @chargeid) if (@pp = 1) begin set @pages = (select pages from tblcharges inner join tblrequest on requestid = fkrequestid where requestid = @id) if (@pages > 0) begin set @pagefee = (select perpagefee from tblmainfees where mainfeesid = @chargeid) set @pagecharge = (@pages * @pagefee) end end ...
select @pagecharge as PerPageCharge
Or should I do some complex query with only one select?
Im a bit confused as to what is best. I have a web site built in c# web dev which utilises a data base. What is best practise ........... 1. To have one sql data source on one page and all other pages use that source. 2.. each page has its own source and connection string depending on its data requirements. 3..... have no source and use insert statements with stored procedures because most of my site extracts data from visitors rather than displaying data to them. If I have this right.......the data source is a copy of the data base that is available for use to the visitor or is it just part of the connection to the data base. My only gripe with the whole development process has been the discovery that I have learnt four ways of doing the same thing.......which in its self becomes confusing.. However one thing has stood above all else ........this forum richard
1 SELECT 2 RowNumber, 3 'Source.Dbf, Plan.Dbf', 4 'Source Name is missing for Source Number "' + IsNull(RTrim(f.SOURCE_NUM),'Unknown') + '" in Plan.Dbf table.' 5 FROM 6 SourceDbf f 7 JOIN 8 ( 9 SELECT DISTINCT 10 SOURCE_NUM, 11 (Select CASE s.SOURCE_NUMWhen 1 Then SRC1NAME 12 WHEN 2 Then SRC2NAME 13 WHEN 3 THEN SRC3NAME 14 WHEN 4 THEN SRC4NAME 15 WHEN 5 THEN SRC5NAME 16 WHEN 6 THEN SRC6NAME 17 WHEN 7 THEN SRC7NAME 18 WHEN 8 THEN SRC8NAME 19 WHEN 9 THEN SRC9NAME 20 WHEN 10 THEN SRC10NAME 21 WHEN 11 THEN SRC11NAME 22 WHEN 12 THEN SRC12NAME 23 WHEN 13 THEN SRC13NAME 24 WHEN 14 THEN SRC14NAME 25 WHEN 15 THEN SRC15NAME 26 END 27 FROM 28 PlanDBF p 29 Where 30 p.PLAN_NUM = s.PLAN_NUM 31 ) as SourceName 32 FROM 33 SourceDBF s ) c on f.PLAN_NUM = c.PLAN_NUM
i am getting an error on Line 33 and this what the error says... Msg 207, Level 16, State 1, Line 33Invalid column name 'PLAN_NUM'.