I Asked This In Sql Express But Hoping To Get A Different Answer Here.
Apr 24, 2007
Here is my goal please let me know if it is possible.
I have installed sql express on clients machines. I don't want them to be able to view the sp's or the functions. I would like to go as far as not allowing them to see the tables. I tried with encrption but this is still breakable by the user using the DAC.
Does CE
Support transactionscope?
What would I use to create tables and sp's for my sdf database? Server Managment Studio or something else?
I understand that SQL Express is a free tool and its placed between Access and SQL 2000 / 2005. I also understand that it supports Database upto 4 GB, which is quiet sufficient for any small or medium sized company.
My question is a bit confusing... let me explain. We get Access database free by the hosting comany. We just have to pay extra if we need SQL 2000 or SQL 2005 support, depending on size.
Will we get SQL Express Free support as its a lready free for all. In Access case, we just have to upload .mdb file along with rest of our code, what is the procedure for uploading SQL EXPRESS data. I believe since its a light weight tool,all the procedures must be same like Access.
I installed, uninstalled, deleted, editted my registry etc and I finally goto to this error while trying to install VS2005 (released) on a Windows 2000 PC (that had Beta2 and RC1 installed & uninstalled):
Update [table1] Set [table1].[field1] = [table2].[field3] Where [table1].[field1] = [table2].[field2]
I have a temp table [table2] with the corrected value [field3] in it I need to update every row in [table1] where [field1] matches the incorrect [field2] in [table2]
So I have another query I can't seem to function the way I was hoping. I've learned a lot in this past month or so but I've hit another challenge. Anyways what I'm trying to do is when a user/student wants to add a new major I want to show a list of majors that are NOT already in his/her profile. So basically if I had a full list of majors: Accounting Computer Science Mathematics
and the user already had Mathematics in his/her profile I'd like it to display only:
Accounting Mathematics
Below is the layout of the tables, my attempt at the query, and then below that some example data.
Code Snippet
USE [C:COLLEGE ACADEMIC TRACKERCOLLEGE ACADEMIC TRACKERCOLLEGE.MDF] GO /****** Object: Table [dbo].[Majors] Script Date: 04/17/2008 22:38:06 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[Majors]( [MajorID] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, CONSTRAINT [PK_Majors] PRIMARY KEY CLUSTERED ( [MajorID] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]
GO SET ANSI_PADDING OFF
USE [C:COLLEGE ACADEMIC TRACKERCOLLEGE ACADEMIC TRACKERCOLLEGE.MDF] GO /****** Object: Table [dbo].[MajorDisciplines] Script Date: 04/17/2008 22:38:16 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[MajorDisciplines]( [MajorDisciplineID] [int] IDENTITY(0,1) NOT NULL, [DegreeID] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [MajorID] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [DisciplineName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [Description] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [Criteria] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, CONSTRAINT [PK_MajorDiscipline] PRIMARY KEY CLUSTERED ( [MajorDisciplineID] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[MajorDisciplines] WITH CHECK ADD CONSTRAINT [FK_MajorDiscipline_DegreeID] FOREIGN KEY([DegreeID]) REFERENCES [dbo].[Degree] ([DegreeID]) GO ALTER TABLE [dbo].[MajorDisciplines] CHECK CONSTRAINT [FK_MajorDiscipline_DegreeID] GO ALTER TABLE [dbo].[MajorDisciplines] WITH CHECK ADD CONSTRAINT [FK_MajorDiscipline_MajorID] FOREIGN KEY([MajorID]) REFERENCES [dbo].[Majors] ([MajorID]) GO ALTER TABLE [dbo].[MajorDisciplines] CHECK CONSTRAINT [FK_MajorDiscipline_MajorID]
USE [C:COLLEGE ACADEMIC TRACKERCOLLEGE ACADEMIC TRACKERCOLLEGE.MDF] GO /****** Object: Table [dbo].[MajorDisciplines] Script Date: 04/17/2008 22:38:16 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[MajorDisciplines]( [MajorDisciplineID] [int] IDENTITY(0,1) NOT NULL, [DegreeID] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [MajorID] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [DisciplineName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [Description] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [Criteria] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, CONSTRAINT [PK_MajorDiscipline] PRIMARY KEY CLUSTERED ( [MajorDisciplineID] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[MajorDisciplines] WITH CHECK ADD CONSTRAINT [FK_MajorDiscipline_DegreeID] FOREIGN KEY([DegreeID]) REFERENCES [dbo].[Degree] ([DegreeID]) GO ALTER TABLE [dbo].[MajorDisciplines] CHECK CONSTRAINT [FK_MajorDiscipline_DegreeID] GO ALTER TABLE [dbo].[MajorDisciplines] WITH CHECK ADD CONSTRAINT [FK_MajorDiscipline_MajorID] FOREIGN KEY([MajorID]) REFERENCES [dbo].[Majors] ([MajorID]) GO ALTER TABLE [dbo].[MajorDisciplines] CHECK CONSTRAINT [FK_MajorDiscipline_MajorID]
SELECT MajorID FROM Majors majs WHERE majs.MajorID NOT IN (SELECT majDis.MajorID FROM MajorDisciplines majDis WHERE majDis.MajorDisciplineID NOT IN (SELECT sMajors.MajorDisciplineID FROM Student_Majors sMajors WHERE sMajors.StudentID = 0)) dbo.Majors MajorID Accounting Computer Science Mathematics
Oh also for the MajorIDs I don't want it to return duplicates such as the Accounting in MajorDisciplines...which I was hoping my query wouldn't do but it returns absolutely random data...
This pertains to SQL Server 2000Do others have the problems that we have in our company, where we havea field from a table, and need to know all the SQL Server processesthat may change that value? I'm still hoping somebody can tell me of atool, or set of queries or something that will document the fields inthe tables and the processes that affect them, along with the valuesthat it sets. For example:TableA.FieldA:sp_InsertNewRec: sets field to Null when new record createdsp_ChangeStatus: sets field to the value of the parameter passed intr_LogChanges: sets field to be the current datetimeMaybe we're just too sloppy at my company, but it seems to be fairlyobvious need to have some sort of automated process that can providethat documentation. With thousands of fields, hundreds of storedprocedures, triggers, DTS's etc..., documenting this information is aVERY daunting task. Any help at all would be appreciated.Gary
Dear GroupI'd be grateful if you can provide me with a hint for the following:Fields Table ContactContactIDFirstnameLastnameFields Table ContactMethodContactMethodIDContactMethodTxtContactMethodTypeIDLinked by Tables:Fields Table LkTbl_Contact_ContactMethodLkTblIDContactIDContactMethodTypeIDFields Table ContactMethodTypeContactMethodTypeIDContactMethodThe purpose of this construct is that I keep all contactmethods suchas Email, Mobile, Home Work, Web in table ContactMethods. Whether it'se.g. an Email or Mobile is identified through the ContactMethodType.That enables me that a Contact can have 3 Mobile Numbers, 2 Emailaddresses.For the sake of simplicity, lets say I want to return the Contact Nameand Home, Work and Mobile numbers. Not all of them but the firstmatching record of each from the ContactMethod table.I must note that the contents of table ContactMethodType for columnContactmethod looks like this:EmailMobileHomeWorkWebI do:Select Firstname, Lastname, Home, Work, Mobile FROM ContactJOIN LkTbl_Contact_ContactMethod ON(LkTbl_Contact_ContactMethod.ContactID = Contact.ContactID)JOIN ContactMethod ON (ContactMethod.ContactMethodID =LkTbl_Contact_ContactMethodID)JOIN ContactMethodType ON (ContactMethodType.ContactMethodTypeID =ContactMethod.ContactMethodTypeID)The question is, how do I map the result from table ContactmethodTypeto my fields Home, Work and Mobile in the resultset? The Type isidentified in ContactMethodType but I can't figure out how to do thisbest.Your help and suggestions or any other better solution is veryappreciated.Thanks in advance for your help and efforts,Martin
If you have followed a link to this page (i.e. the URL contains "SearchTerms=xxx") please scroll down to see items of interested highlighted
This list of SQL Server Frequently Asked Questions (FAQ) was originally compiled in August 2005 based on the most frequently "read" posts on SQL Team. Since then new links have been added as topics become popular - so it might be better referred to as FGA - Frequently Given Answers!
NC=Indicates that the Article has NOT been checked for relevance. As time goes on these are getting fewer and fewer The latest change is in Red Recent changes are in Teal
URL to link to this post: 17Nov2005 http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms= Followed by either "Keyword1,Keyword2" or "PhraseWord1+PhraseWord2"
The icon allows you to RightClick-CopyShortcut to provide a link to this topic with appropriate keywords - I got bored of having to make them manually! 07Mar2006 Stats
Homework I put this one at the top, in case you don't read any further. To find out if your homework will be answered on this forum you should see if it qualifies: Requirements for homework questions 07Mar2006 Example of Failure to meet the minimum requirements 07Mar2006 Learning SQL www.sql-tutorial.net 07May2007 www.firstsql.com/tutor.htm 07May2007 www.w3schools.com/sql/default.asp 07May2007
Why? Why is my LDF Log File so big / getting bigger / bigger than my MDF 14Oct2005
How to
How to ask a question on SQL Team and get a quick answer - i.e. the information you need to provide 06Nov2006 How to format your question or a reply (in particular see the [code] option 18Sep2007 how to encrypt and decrypt my password 07May2007 Rounding up/down to nearest multiple (e.g. order in dozens, buy at least 30) 28Sep2006 Replace multiple spaces, or other character, with single space 28Sep2006 Generate a Random String 13Sep2006 String comparison 24Jul2006 Article: Images and SQL Server How to get Images or blobs into SQL table (NC) Inserting Images as BLOB in SQL server table (NC) How to use DeBUG window in QUERY Analyzer (NC) Use a Parameter in the Top clause Dynamic SQL or How do I SELECT TOP @var records? Can't insert NULL into table with unique key (NC) Efficient paging of recordsets with T-SQL Article: Paging in SQL 2005 07May2007 Execute dynamic SQL that is longer than varchar(8000) 05Oct2005 Convert multiple spaces to single spaces 14Oct2005 Making Upper/Lower Case Sensitive comparison 27Oct2005 Convert to Proper Case (each word starts with capital) 19Feb2006 Deleting a massive number of rows 04Mar2006 Combine values from rows into a column 05Oct2005 i.e. FOO 1 FOO 2 becomes: FOO 1,2
CSV / Splitting delimited lists WHERE IN @MyCSV Article: Passing a CSV or Array to a Stored Procedure (NC) Best split functions and Concatenating data from rows with same GroupBy column Triggers Triggers to audit changes trigger to keep tables matching Set Update/Modified date column using a trigger 02Nov2005 Deactivating a trigger 07Feb2006
SQL Team Articles Article: Identity and Primary Keys - and Surogate Keys See also Article: Sending SMTP Mail using a Stored Procedure (NC) Article: Dynamic ORDER BY (NC) Article: More Trees & Hierarchies in SQL (NC) Article: Using SELECT to INSERT records (NC) Article: Deleting Duplicate Records Article: Returning a Row Number in a Query (NC) Article: Calculating Running Totals (NC)
Datatypes / Collation
GUIDs (NC) IsGUID check GUID is valid 01Aug2007 DATALENGTH() and LEN() 21Sep2005 Compare BIT columns and a BitMask column 05Jan2006 Collation conflict in Assignment or WHERE clause 05Feb2006 (See "Developer / Techie stuff" below for some other Collation links)
Datatypes - Dates
Time Only Function: F_TIME_FROM_DATETIME 29Apr2006 Date/Time Info and Script Links (including UNIX time) 16Apr2006 Date formatting ( Format Date/Time (NC) last date of the month (NC) Getting the date portion of a datetime value or Round a date to Year, Quarter, Month, Day, Hour or Minute How to get date in t-sql (NC) compare date with current date (NC) convert varchar to datetime (NC) Compare dates regardless of time? (NC) Convert varchar to date (NC) Time in Analog (NC) Start of Week Function (NC) Earlier date than 1/1/1753
Techniques
Prevent Administrators accessing a database 14Sep2006 SELECT vs SET 26Sep2005 What is a cursor, Why is it bad? 23Sep2006 Cursor or Not (NC) TSQL/ SP Best Practices (NC) case-sensitive (NC) User-Defined string Functions Transact-SQL (NC) Passing an array into a stored procedure (NC) Comparing two tables or views easily (NC) All Tables in All Databases (NC) Better Phonetic Matching Algorithm (A better Soundex) Levenshtein Edit Distance Algorithm (A better Soundex) Fuzzy matching 01Aug2007 Find tables with no PK (NC) Function: HTMLDecode (NC) How to protect errorlogs to tables from rollbacks (NC) Distance of Zip/Postcodes Great Circle Formula 07May2007 Haversine Formula 07May2007 Accuracy v. Speed 07May2007 See also here, here, here, here and here and here Upsert - combined Update/Insert Procedure 01Aug2007 and here Display all columns but only for rows with the most recent date 01Aug2007
Developer / Techie stuff
Changing column names on referencing objects 07May2007 When was DB object last updated 07May2007 How to clear the whole database 07May2007 Move / Script Development Database Changes to Production Database / Ship Application updates 04Nov2006 Script to analyze table space usage 11Oct2006 What version, and Service Pack, of SQL Server am I using? 23May2006 SQL Beautifier 13Apr2006 Performance / System Monitor / PerfMon - preferred values for counters 04Apr2006 SQL Server 2000 Knowledge Base Articles - updated every 3 days 21Jan2006 Concerns about SQL 2000 SP4 08Jan2006 Support stops for SP3a AND installing sp4 on cluster 26May2006
How to read Mssql transaction log file Compare data in two tables / two databases 31Oct2005 Recommended books 07Oct2005 Good tools for DBAs 06Oct2005 Best SQL Security Method (NC) Some query optimalisation (NC) Requirements for Horizontal Partitions Multiple SQL Server 2000 Instances (NC) Primary Key v. Unique Index (NC) HOWTO Run SQL Profiler without sysadmin rights (NC) upgrade from SQL7 to SQL2000 (NC) xp_cmdshell execute right (NC) Monitor object usage over time (NC) size of user tables in a database (NC) Changing Column Length (NC) Add, Sub, Mul, Div With Really! Big Numbers (NC) So you're a DBA eh?! Why I'm not a DBA (NC) Do you S-Q-L or Sequel (NC) Interview questions (NC) More Interview questions 11Sep2006 Best steps to becoming a DBA (NC)
Developer / Techie stuff - Collation
Bulk Delete of Records 07May2007 and locking issues 01Aug2007 Deleting lots of Records from a large table 01Aug2007 Synchronising data using staging tables 07May2007 Version Control 07May2007 how to change Collate on the server 20Sep2005 How to change default collate in SQL 20Sep2005 Cannot resolve collation conflict for equal to OP 20Sep2005 different Collation Settings between Databases 20Sep2005
Database Design and Structures
Codes - Common Lookup Tables CLT 04Jun2006 Good table naming convention 09May2006 Naming Store Procedures 09May2006 Recursion / Hierarchy 29Apr2006 Hierarchies (NC) Normalisation (NC) NULL opinion? (NC) Finding evidence of sql injection attack Security Testing: SQL Injection 09May2006
Locking
Using the NOLOCK hint 07Jun2006 how does row locking work (NC)
EMail
sp sending mail (NC) CDOSYS Send Email (NC)
XML
SQL Server 2000 XML (NC) Adding an XML Root Tag Handling tricky namespaces in OpenXML
Backup / Restore / Replication / Jobs / Houskeeping
Backup How Backup works What type of backup should I use? - Full, Differential, Transaction? Should I shrink the log? 22Jan2006 Automating Backups - Scripting v. Maintenance Plan / Wizard 08Mar2006 Backup to Disk, or direct to Tape? 05Dec2006
Disaster Procedure Checklist I think I have a database corruption, how do I mitigate any further damage and get upright again? 07May2007 How I Rescue Data from Corrupted Databases 07May2007 Disaster Recovery Plan 07May2007 Quiesce the SQL Service to enable low-level copy 01Aug2007
Restore RESTORE syntax / example Restore SQL 2005 to SQL 2000 via Downgrade 07May2007 Restore Full and all TLogs backups based on files in disk folder 07Dec2006 Move database to a new server (with minimal downtime) 16Feb2006 Moving to a new sql server 25Jun2006 Fix Orphaned Users (after a Restore or moving DB to a different server) Script User Logins after a Restore 01Aug2007 and Scripting users & logins from one server to another (e.g. after moving DB to a different server) 25Jul2006 how long will take to restore a 10 gb? All I have is the .bak file Restoring .BAK file to a different server? Unable to restore/attach a MDF file (single file attach / sp_attach_single_file_db) See also: This and this and this
Shrink Database / Files
Shrinking TEMPDB 19Apr2006 Database Shrinking 09Jan2006 Log Shipping -Shrinking Log and Data files (NC) MSDB Massive msdbdata.mdf
Housekeeping / Maintenance
Tara Blog Houskeeping Routines 06Oct2006 Index Tuning Wizard 07May2007 User Rights for SQL Service 07May2007 When was SQL Server last restarted? 07May2007 Optimising your indexes with DBCC INDEXDEFRAG 06Oct2006 Detach Move Db & Log File Reattach 17Mar2006 Rebuilding Indexes DBCC CHECDB, CHECKTABLE, NEWALLOC (old) Suspect Databases after Power Cut? Jobs failing (NC) Reindex All Tables in All Databases (old) deleting replication (NC)
Export / Import / DTS
Copying/backing up DTS Packages (NC) Export to Excel (NC) Generate INSERT statements for N rows of data Tool to script database records? (i.e. generate INSERT statement script) How to convert DATE Format from DD/MM/YY to MM/DD/YY in DTS (NC) Importing an Excel File with DTS (NC) Is DTS Secure for credit card backup to Access? (NC) Winzip in scheduled DTS Package (NC) Article: Using BULK INSERT to Load a Text File (NC)
Output / Reporting / Formatting
Pivot table (NC) Article: Dynamic Cross-Tabs/Pivot Tables (NC) which led to: More Dynamic CrossTabs using T-SQL 04Aug2006 (Jeffs Blog)
Error Messages
SQL Server does not exist or access denied (NC)
Connections
Linked Server Newbie Question (NC)
Configuration / Hardware
/3GB in boot.ini on Win2003 standard 19Oct2005 SQL memory /3gb /PAE AWE 19Sep2005 SQL Server Standard & 4GB memory Using AWE option in SQL Increasing SQL Server Memory
MSDE
MSDE Setup fails (NC) MSDE Install Issue (NC) Installing MSDE on XP Pro (NC) Backing up MSDE database (NC)
SQL 2005 / Yukon
Migrating to SQL 2005 Hints and Tips 01Aug2007 SELECT not allowed in Yukon/SQL2005? (NC) Download Yukon/SQL2005 (NC) SQL Server Management Studio (NC)
MySQL, Oracle, and the others
MySQL not as good as MS SQL? Migrating from Oracle to SQL Server
Other
SQL Reporting Service SP2? (NC)
Got an hour .. or ten ... to spare?
Would you work at Elwoo's office? Simple Quiz What is a Yak? 07May2007
Hello, I have several SQL 2000 logins on our servers. I removed the builtin/ groups and only have SQL authentication users, although the server is operating in "Mixed Mode". How can I secure this? I don't understand how we can just connect to any DB without ever being asked to log in. Let me know if you can help. Thanks.
I am new to the forum and would like to have a question answered. I want to to install Sql Server Express with advanced services but also want to have IIS installed as well. My question is, how do I install IIS without it opening Port 45? When I installed it, it would not let me finish installation without letting it act as a server. Is there any work around to solve this problem that any of you have managed to use?
I have a field which stores date which the datetime datatype... The problem is that I am also getting time information in this stored field.
I just want to extract the date part in dd-Mmm-yy format (e.g. 07-May-04). I tried convert (char (8), MyDateField, 112) but it gives me date in yyyymmdd format. How do I get the results in dd-Mmm-yy format instead?
I have a question about the best method to ensure the proper flow of control within a package. I have three related SQL tasks €“ A, B, and C €“ that must execute in sequence. If any one of the tasks fails then the remaining tasks should not execute because each is dependent on the previous step. (A €œsuccess€? precendence constraint.)
Likewise, I have a second set of SQL tasks €“ 1, 2, and 3 €“ that must execute in sequence. Task 3 should never execute unless tasks 1 and 2 have been successful.
I consider these to be two independent logic paths in the same package and, indeed, when I run the package both task A and task 1 begin running at the same time.
What I€™m not sure of is how to add a new task €“ Z €“ that will execute only after both the A-B-C and 1-2-3 task paths have completed. Diagramatically, this would be like having a €œcompletion€? constraint linking task C to task Z and another €œcompletion €œ constraint linking task 3 to task Z. In other words, the two independent paths merge at task Z. Task Z is an audit step that must always run €“ it emails summaries of the database activities performed by the other tasks.
What has me puzzled is how I get to Z when there is a failure in either the A-B-C path or the 1-2-3 path. As things stand now, the package will never reach task Z if there is a failure in an earlier task because they are joined by a €œsuccess€? constraint.
I thought I could get around this by using a €œsequence container€? but I discovered when I added A, B, and C to a container that I couldn€™t use the €œsuccess€? constraint I needed. I was just guessing that this might be the way to do it.
Can anyone help me with a best practice approach to the control flow issue I face? I€™m new if that isn€™t apparent by my question, so don€™t be afraid to make your answer simple and plain.
Unbelieveible! I can not seem to find any source for questions database related that don't include using 2.0 controls just as the come out of the box! HELP!!!! Simple issue (or so it seems) but I can't get an anwer: Example: TextBox.Text has information that I want placed in a table in a sql database. So I build a SQLDataSource control, and the triggers to fire the insert method. I modify the InsertCommand of the SQLDataSource so that it will write my record to the table. Something like... InsertCommand="INSERT INTO MyTable(Description, Status) VALUES ('TextBox.Text', 'Default New Record Status)" Now... the problem is with 'TextBox.Text' . When formated as is. the text string TextBox.Text is inserted into a record in the target table. My problem, the simple one remember, is refering to the text string stored inside of TextBox.Text and have that value stored in the new row under the Description column. I can't believe that no one can help with this simple problem. Once resolved then my page is done... this is ALL that holds it up and I can't find a reference to how to go about it. Thanks,Ken....
Hi, I'm working on both VWDEE and VBEE and, in each, when I try to add a database diagram I get the following error message 'Invalid Class String' (after the 'Do you want to create required objects' prompt). Can someone postulate a reason? If I don't get an answer i'll be pretty much dead in the water Thanks in advance of your help.
"Falling back on cursors because they remind you of datasets will result in poor performance "
Hi, The above quote was from an article which advice to use store procedure and avoid T-sql in the body of a webpage. Anyway, To me, I always use cursor when I want to process one row at a time. Is there an alternative to cursor in MS sql server to have similar results.?
Please suggest correct answer (A,B,C,D) for the following Question
You are developing an application for a worldwide furniture wholesaler. You need to create an inventory table on each of the databases located in New York, Chicago, Paris, London, San Francisco, and Tokyo. In order to accommodate a distributed environment, you must ensure that each row entered into the inventory table is unique across all location. How can you create the inventory table?
A.Use the identity function. At first location use IDENTITY(1,4), at second location use IDENTITY(2,4), and so on. B.Use the identity function. At first location use IDENTITY(1,1), at second location use IDENTITY(100000,1), and so on. C.CREATE TABLE inventory ( Id Uniqueidentifier NOT NULL DEFAULT NEWID(), ItemName Varchar(100) NOT NULL, ItemDescription Varchar(255) NULL, Quantity Int NOT NULL, EntryDate Datetime NOT NULL). D.Use TIMESTAMP data type.
Give the suitable answer for the below question and explain the answer.
1.You have designed the database for a Web site (or online ticketing agency) that is used to purchase concert tickets. During a ticket purchase, a buyer view a list of available tickets, decides whether to buy the tickets, and then attempts to purchase the tickets. This list of available tickets is retrieved in a cursor. For popular concerts, thousands of buyers might attempt to purchase tickets at the same time. Because of the potentially high number of buyers at any one time, you must allow the highest possible level of concurrent access to the data. How should you design the cursor?
(A). Create a cursor within an explicit transaction, and set the transaction isolation level to REPEATABLE READ. (B). Create a cursor that uses optimistic concurrency and positioned updates. In the cursor, place the positioned UPDATE statements within an explicit transaction. (C). Create a cursor that uses optimistic concurrency. In the cursor, use UPDATE statements that specify the key value of the row to be updated in the WHERE clause, and place the UPDATE statements within an implicit transaction. (D). Create a cursor that uses positioned updates. Include the SCROLL_LOCKS argument in the cursor definition to enforce pessimistic concurrency. In the cursor, place the positioned UPDATE statements within an implicit transaction.
What are his steps in the execution of a query? Where/how does he storage the information while executing a query? What type of Index he uses? and so on ...
If anyone knows a website that contains this type of information about the SQL Server SGBD and could share it i would be most appreciated!
1)Which statement shows the maximum salary paid in each job category of each department?_______ A. select dept_id, job_cat,max(salary) from employees where salary > max(salary); B. select dept_id, job_cat,max(salary) from employees group by dept_id,job_cat; C. select dept_id, job_cat,max(salary) from employees; D. select dept_id, job_cat,max(salary) from employees group by dept_id; E. select dept_id, job_cat,max(salary) from employees group by dept_id,job_cat,salary;
2)description of the students table: sid_id number start_date date end_date date which two function are valid on the start_date column?_________¡£ A. sum(start_date) B. avg(start_date) C. count(start_date) D. avg(start_date,end_date) E. min(start_date) F. maximum(start_date)
I'm trying to write a "GetQuote" procedure with a single @Quantity parameter. The purpose of the query is to sum the total cost (price * quantity) of a given (quantity) given the available "Sale" items. The sale table has the following structure:
[SellOrderID] [uniqueidentifier] DEFAULT (newid()), [OrderDate] [datetime] DEFAULT (getdate()), [UserID] [nvarchar](50) , [SellPrice] [float] , [SellQuantity] [int] , [QuantRemaining] [nchar](10) NULL, **QuantRemaining is the sell quantity remaining after existing partial trades on the Sell Order - intentionally denormalised.
A given quantity may be satisfied by multiple 'Sell Orders' and these should be processed from the lowest price first.
e.g. give the following: SellOrderID QuantRemaining Price A 100 $2.00 B 300 $3.00 C 200 $1.75 D 350 $2.50
GetQuote 400 should return: Sum((200*$1.75)+(100*$2.00)+(100*$2.50))
I am relatively new to the DB game and am having problems creating a SQL statement to do this. If anyone has a solution for this it would be greatly appreciated.
I would really appreciate it if someone could give me the answers or directme to a place that would have the answers to the following 5 questions.1. I need an example of SQL select statement. (table tblSource, fields A,B,Cwhere C<100).. "is this an example that I have in ( )?2. I need to list 3 table joins or is "inner, outer, left" etc actual tablejoins? what are the others for my own knowledge.3. Can you join a table to itself? (how? Alias.)4. What is the diff, between distince and distinct row?5. How would you check a value agains a lookup tableA? (IN) or is "IN" theanswer?I am very sorry for my stupidy but I am trying to learn and my boss for onereason or another gave me a ton of questions I cant answer.Someone please help!
Has anyone encountered this error message [Microsoft][ODBC Driver Managr] Driver does not support this function? This occurs when importing data. The company I work for upgraded to Server 2005 and now what once worked fine now has an error. Any suggestions?
hi all, i want to create such a page contains Questions , Answer(this is text feild entered by user) and Correct answer(that can be seen only by admin). Both questions and correct answers already exist in database. When user click the save button ,the answer will be saved into the database and when user click the submit button ,the email notification will be sent to admin. Which control can i use and any advice for my requirements is appreciated. i'm using visual studio 2003 and sql2000.
Hi, I have a table that has the ff: LastName varchar(50) FirstName varchar(50) PhotoPath varchar(50) Now I want to create a form that can accept the LastName,Firstname and also can upload a picture which in turn the filename of the image will be the value for the PhotoPath field, and eventually displays it using the repeater control. Your Help/Info. is highly appreciated...
For some reason I can't reply from within your message.
Make sure you have the same version of SQLserver and service pack on the SQL Server and the workstation you are trying to set up the package from, this is error due to different versions.
Your comand should look like: dtsrun /~S.... /~U ..... /~P ....
----------------------------------------
Subject: From: Date: DTS problem aruna (aruram@hotmail.com) 3/20/01 2:19:38 PM
Hello
I have created a very simple DTS package to transfer data from one database to another on the same server. I am able to successfully execute the package from DTS. But if i try to schedule the package and run it from SQL agent it fails. The job that is created by the SQL agent appears as follows -
and the error message i get is invalid switch .... DTS command invalid options
I have tried working with the /N and /!Y options and they dont work either. Can someone please tell me why is this problem occurring in the first place.
Nobody helped me on other SQL forums, I hope here people are better. Here is my problem : I'm trying to uninstall replication before to re-install it (2 servers working on Windows NT and SQL 6.5 SP5). On the publisher server, I chose Server/Replication Configuration/Uninstall Publishing, but then, I'm not able to re-install publication, as the 'Install Publishing' option is disabled. I've found somewhere on the web that I had to remove the distribution option from the system, which disables replication, with the sp_ServerOption stored procedure :
sp_ServerOption "myserver", "dist", false
then I've deleted the distribution database, but all this didn't change anything, the 'Install Publishing' option is still disabled. How can I get the option enabled ?
Thanks in advance if you can help me. Sorry for the English, it's not my native language.
I have a view based on few tables okay I have a query that gives me document details of various revisions Now i also get the latest rev of those if i use a MAX() in my Query
And if i filter for a month of 12/2004 If i query for latest it should give Document1 - rev2
Now i need to get a filter with latest as rev2, plus i also need as a indication of actual latest as rev 7 using a query
How do i do that ...
Coz when i use filter for a month and Max then it does not consider rev7 for that filter and skip the record and if i try to filter only as per month .. i get a wrong info as latest rev2 which is not a true info as per database records.
May i possibly get both ... filtered info as per specific month and also a rev info as what is the latest for a spec document.
Just i need to know is that possible .. in SQl using a query
Any more info needed please mail me on neeraj.jariwala@gmail.com
Guys Hunting high and low for the definitive answer to this query.
I need a system to enable the import of a csv file (trypically contacts exported from Outlook) into a SQL Server table unique to that user through a .aspx page.
At the first and most basic level I need to simply get the data into a table.
The ultimate goal though is to have a fully functioning system whereby the user can sync between the csv file and the database enabling them to upload the data for the first time then only update changes subsequently (new records/changes to existing records) etc.
1. Does anyone have code that does such a thing? 2. Does anyone know of a component/utility that can be purchased off the shelf. 3. Is there someone with the capacity to write such a module?
Easy SQL question....first to answer correctly gets...the satisfaction of knowing he helped a fellow developer in need.
Runnning SQL 7.0 on an NT 4.0 platform in a client server network environment. Authentication is done on the NT level. Each user has his/her own name and password. Most users use the same shared software app.
QUESTION: Can the same user login to multiple machines concurrently and run applications without fear of locking or hanging or causing other mischief?