SQL Gets Corrupted With 'WITH' Command And Rubbish When Editing Query Containing Derived Table
Jan 31, 2008
When my colleague makes any change to a query containing a derived table, the word 'WITH' followed by a lot of graphical characters appears after the alias, rendering the query unusable. We have tried this with various existing and new, simple queries, all to no avail. We are editing the queries in Visual Studio 2003, and he does not get this effect when using Visual Studio 2005. I can edit the query in 2003 on my laptop with no ill effects.
Help!
Karen
View 17 Replies
ADVERTISEMENT
Jul 23, 2005
Hi All !I open a table in Query Analyzer by right clicking on it andselecting 'Open' and when the data is displayed in the view pane Iwould like to be able to edit it. It seems however that tables markedas read only (as shown on the top bar e.g. SQL Query Analyzer - [OpenTable ServerName.DBName.dbo.TableName(read-only)] ) can not be editedwhereas the one that do not have that attribute infront of the name Ican edit. Is there a way I can change the read only attribute of atable so that I can edit data directly in the view pane?Please let me know if there is !Thanks a heap ! :)Harkirat
View 2 Replies
View Related
Oct 4, 2007
Hello everyone.
I'm not very experienced with SQL Server Express. As a matter of fact, I've been with it for less than a week.
I'm currently working on a project in which I need to distribute SQL Server Express in a fast and comfortable way to install to users that aren't quite computer-abled and to prevent confusion for them, we want to prepare a simple batch file that installs everything through commandline, with all the inputs already given.
The type of installation that we want to achieve is as follows:
-We want it to be in the default instance
-We want the service to be SQL server, using the built-in System account, using the Local system
-We want to use the Authentication Mode to be the Mixed Mode, using the following password for the "sa" account: mySentences
-We want to disable the access of all users who aren't the "sa" user
The command line that I'm currently using I'm sure that is incorrect:
SQLEXPR32.EXE" /qb INSTANCENAME=MSSQLSERVER ADDLOCAL=ALL SQLACCOUNT= AGTACCOUNT= SQLBROWSERACCOUNT=
I've been notified that osql could serve useful as well, but I'm having some problem with that too.
My osql command that i'm running are:
osql -E -s%COMPUTERNAME% -Q"ALTER LOGIN [sa] WITH PASSWORD=N'mySentences', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=ON"
osql -E -s%COMPUTERNAME% -Q"EXEC sys.sp_addsrvrolemember @loginame = N'sa', @rolename = N'sysadmin'"
osql -E -s%COMPUTERNAME% -Q"DENY CONNECT SQL TO [BUILTINUsers]"
osql -E -s%COMPUTERNAME% -Q"DENY CONNECT SQL TO [BUILTINAdministrators]"
Any help would be greatly appreciated. Thanks in advance!
View 2 Replies
View Related
Aug 1, 2007
I'm trying not to use a temp table, but i may have to do so..
I'm using sql2005 for this case.
i have a derived table that makes the following results:
ID Status Name
2 1 "A"
2 2 "B"
I want to get the following:
ID Name1 Name2
2 "A" "B"
but like I said before, I can't repeat the query that gets the first 2 rows, as it's pretty invovled. a temp table is the best route I see right now, but I just wanted to be sure I'm not missing something. If I've aliased it as 'results', is there a way to alias results again as something else? or maybe a trick with CTEs? I will try that! It seems promising.
View 1 Replies
View Related
Aug 1, 2007
I'm trying not to use a temp table, but i may have to do so..
i have a derived table that makes the following results:
ID Status Name
2 1 "A"
2 2 "B"
I want to get the following:
ID Name1 Name2
2 "A" "B"
but like I said before, I can't repeat the query that gets the first 2 rows, as it's pretty invovled. a temp table is the best route I see right now, but I just wanted to be sure I'm not missing something.
View 5 Replies
View Related
Jul 19, 2007
Hi,
In my SSIS package,
1. I read from a source namely SOURCE. SOURCE is defined like
CREATE TABLE SOURCE
( f1 int, f2 int, f3 int, id int)
, where f1 is unique and id is always null after reading.
2. pass it to a Slow Change Dimension control to separate the new records and changed records
Then for new records,
3. link to a Derived Column control to add in some new columns
4. link to a OLE DB Command control to update field id before write to destination
In Step 4, I use the command :
INSERT INTO global_id_pool
SELECT MAX(id) + 1
FROM global_id_pool
UPDATE SOURCE
SET id =
(SELECT MAX(id) FROM global_id_pool)
WHERE f1 = ?
Using the command, the parameter can't be recognised with an error reported in BIDS. So eventually I had to change the query to the following to make it work
UPDATE SOURCE
SET id =
(SELECT MAX(id) + 1 FROM global_id_pool)
INSERT INTO global_id_pool
SELECT MAX(id) + 1
FROM global_id_pool
I don't mind the parameter can't be added. But after running, I found id field in the table after the OLE DB Command control is still NULL while the field in the SOURCE table in database is updated. So it seems the OLE DB Command worked on database but the data in memory cache wasn't affected.
So I just wonder if there is way to UPDATE the cache in OLE DB Command control. Many thanks for any help.
View 1 Replies
View Related
Nov 6, 2015
Is it possible to access a Derrvied Column from an OLE-DB Command? I have to Update a Table with a join and i need from the source Table columns which have to be pivoted before i can use it in the update Command.
View 4 Replies
View Related
Nov 26, 2007
Hi All! I am using Bulk Insert to obtain data from the text file. This works
perfectly if i try to import it using standard/default Bulk Import . However,
if i try to import using Format file by specifying the two columns (as data
is in two column format) , the import works successfully but applying a
select statement only returns garbage in the rows. What is exactly happening,
i could not able to understand.
View 2 Replies
View Related
Aug 27, 2001
SQL Server 6.5.
Hi!
When I try to create PK, Clustered index on the column in the table I have got error message: 1105 Couldn't not allocate space for object table1......
But it is a big amount of free space in the database. And actually I can create any indexes, exsept clustered with no problem.
DBCC CHECKALLOCK for this table shows: extent not ih the segment.
Does it mean the table structure is corupted? What Can I do to resolve the problem?
Thank you,
Elena.
View 1 Replies
View Related
May 1, 2008
Team,
I am having a critical problem.
We a team of 10 members accessing a particular database with a common user name and password . Some one have deleted the data from a business critical table. Transaction log backup is done every half an hour. Considering backup is taken at 10AM and my data is lost at 10.26AM. How to recover the lost data?
Is it possible to recover the data from log file or any other way to achieve the data recovery?
Is is possible to trace the person who have done this job. (By IP address or any other way)?
Regards,
Venkatesan Prabu . J
View 1 Replies
View Related
Mar 13, 1999
Hi,
I have a corrupted table wich has some valuable data in it. I found out that there is only one raw is corrupted. How do I find out which row of the table is it?
Can any one Help me in this matter Please?
Thanks Very much.
Jay k
View 7 Replies
View Related
May 9, 2008
Hi All,
I have just one corrupted record on a table: I copied everything else to another table but I can't delete or rename the old one!
Is restoring the whole DB my only way out there?
Any help or suggestion would be much appreciated!
Cheers
View 8 Replies
View Related
Aug 15, 2005
Is there anyway possible to edit table design with data already entered in the table.If not, is there anyway I can cut and paste the info back in. Ive tried importing to access and then back to SQL, however, when i tried to view my table design in ASP.NET webmatrix, it gave me an error.
View 1 Replies
View Related
Apr 24, 2015
I've accidentally done something to my install of Management Studio that is making query editing very difficult. I must have used a weird key combination to enable some feature that is now opening an Intellisense like window with suggested keywords or column names. I've tried every option I can find to disable this and even tried all the <ctrl> key combinations from A-Z to try to turn this off. How to have the editor revert to the "default" behavior as installed?
I've received several replies about disabling Intellisense or changing the Intellisense options and I've already done this to no effect. I've also not installed any 3rd party tools. I was editing queries when the problem began and I think I had hit a <ctrl> or <alt> key combination key that started this problem.
View 4 Replies
View Related
May 3, 2000
Hello!
We have a SQL Server table that needs to be maintained by the actuarial department. Therefore, I was going to have them make changes to the table using something easy like Microsoft Access 2000. When I go into Access and create an ODBC link to the table, I cannot change the data. (i.e. The insert new record feature is greyed out.) I CAN change the data via Enterprise Manager, so I don't think it is SQL Server security. Any other ideas?
Thanks,
Sharon
View 1 Replies
View Related
Jun 4, 2015
For prototyping purposes, is there a tool that reads a database's schema and generates (simple) table editor that allows manual editing of data. It would be good if the tool somehow made it easy to add foreign key values to reference data e.g. gender, status, ...I can kind of do this using Management Studios "Edit Top 200 Rows", but I was wondering if there is a more user friendly tool out there.
View 3 Replies
View Related
Jan 21, 2008
Hello,
I am facing an issue with a table in my database.
1) When I run a query Select * from MY_Table the query never completes. If I press cancel in Query Analyzer after 1 second or 2 minutes, it always shows the same 174 records. The total table size is 800 KB with 3148 rows .. according to TaskPad
2) No queries, even queries that would return only 1 record complete execution against that table
3) I am unable to rename the table, if I try to rename the table Enterprise Manager becomes unresponsive and has to be closed.
4) If I try to browse the rows through Enterprise manager by scrolling through the records, it allows me to go down through a number of rows and then Enterprise manager gives me a timeout expired error.
5) I ran a DBCC CheckDB command ran for 1 hr and 7 minutes. It says there are 0 allocation errors and 0 consistency errors in the database.
6) The other database tables seem to be OK and the Database is operational except for calls involving the 1 Table
7) I am unable to Drop the Table
8) DBCC CheckAlloc finds 0 allocation errors and 0 consistency errors.
9) DBCC CheckTable on MY_Table returns with: There are 3148 rows in 33 pages for object 'MY_Table' .. no errors are printed.
Can one of the SQL Gurus on this forum please recommend a course of action.
Thanks in advance.
View 1 Replies
View Related
Aug 16, 2006
Trying to set up a tranform task between a mysql db using and ADO.NET connection and sql server.
My query to pull from the mysql db is something like "select x,y,z from table where last_updated" > @User::LastUpdated. This command is set up as an expression for the Data Flow Task and is the value for the [DataReader Source].[SqlCommand]
I have two questions.
Why does the package attempt a query against the mysql database all the time?
And Why is the query attempting to pull the entire table instead of having any regards for my where clause?
I've even added where last_updated > greatest('2006-08-15', '" + @User::LastUpdated to attempt to get it a where clause even when the parameter isn't set yet.
What is the trick? This is not feasible when pulling from multi-million row tables.
View 2 Replies
View Related
Aug 17, 2000
What is the best way to read and edit data in the tables of a sql server 6.5 database?
Thanks
Gunnar
gunnardl@yahoo.com
View 1 Replies
View Related
Jul 20, 2005
Hello:I have an Access 2K form I built from a SQL Server 7.0 view. I want tolock certain fields in the database from users so they can see them onthe views and forms, but NOT be able to edit them.I've looked in BOL, MS SQL Server web page and SQL Server 7.0 books andcould not find how to do this.Any advise will be greatly appreciated.Thanks,Richard
View 4 Replies
View Related
Mar 12, 2015
We are facing a weird scenario in which the snapshot is getting corrupted after insertupdate few million records in to a table .
SQL Server 2012
windows server 2008 R2
service pack 1
64-bit OS
View 1 Replies
View Related
Jul 20, 2005
Hi,I have an Access application with linked tables via ODBC to MSSQLserver 2000.Having a weird problem, probably something i've done while not beingaware of (kinda newbie).the last 20 records (and growing)of a specific table are locked - cantchange them - ("another user is editing these records ... ").I know for a fact that no one is editing records and yet no user canedit these last records in the MDB - including the administrator -while able to add new records.Administrator able to edit records in the ADP (mssql server) where thetables are stored.Please help, the application is renedred inert .Thanks for reading,Oren.
View 3 Replies
View Related
Jan 22, 2008
Hi, I wanna know is there any advantage of perf gain when using Derived Tables over Temp Tables, advice me which one is better to use. Can I create Indexes and Insert/Update records into Derived Tables.
-Senthil
View 8 Replies
View Related
Mar 10, 2006
I have 3 tables TableA , TableB and TableC
I have to update tableA with the value of TableB by checking A.Field=B.Field
and TABLEB as condition that B.Field should exists in tableC
Update A Set A.Field=B.Field From tableA A
(select B.Field From TableB B where B.Field=A.Field and B.Field in (select C.Field
From tableC C))
How to do it correctly.
Thanks in advance
View 2 Replies
View Related
Feb 28, 2008
Hi,
I have built a database for a university project, but am having trouble with the SQL syntax for inserting derived data from a calculation into a table. At present my SQL is;
INSERT INTO MemberPayment (TotalCharge) VALUES ( [Total] )
SELECT ((MileageHistory.MileageUrban * Vehicle.EmissionsPerGramUrban) * 0.05) + ((MileageHistory.MileageCountry * Vehicle.EmissionsPerGramUrban) * 0.05) AS 'Total'
FROM [NeuCar].[dbo].[MileageHistory] JOIN [NeuCar].[dbo].[Vehicle]
ON MileageHistory.Registration = Vehicle.Registration
JOIN [NeuCar].[dbo].[Member] ON Vehicle.UserName = Member.UserName
WHERE Member.UserName = 'wenger1' AND (MileageHistory.[Date] >= CURRENT_TIMESTAMP - 30);
Would anybody be able to point out where I am going wrong? I would very much appreciate any advice,
Kind regards,
Chima
View 2 Replies
View Related
Oct 6, 2004
I got an error as follows:
Derived table 'A' is not updatable because a column of the derived table is derived or constant.
when I tried to run this query:
update A set MonthsUnbilled =99999888
FROM (select MonthsUnbilled from dbo.vw_MasterView
WHERE (RecordID =8377396)) A
This is a simplified query in order to pinpoint the culprit. I know I don't need to use a derived table if the real query is this simple.
Thanks in advance!
View 4 Replies
View Related
May 12, 2008
Below is my sql, i am getting error msg "Incorrect sytax near 'Votes'."
Can anyone tell me what im doin wrong?
UPDATE #TblExposure
SET E.Unity =
(
SELECT
-- DealId ,DocketId,
CASE Participant2
WHEN nullTHEN 'NA'
ELSE
CASE WHEN Participant2-Vote2 =0 THEN 'Yes'
ELSE 'No'
END
END AS Unanimous1
FROM #tblVoting
) Votes
FROM #tblExposure E INNER JOIN Votes
ONVotes.Dealid = E.Dealid
AND Votes.DocketId =E.DocketId
View 1 Replies
View Related
Jul 30, 2013
I want to rank the below table by Sum [Pts} Desc AS Position?
,Sum(Games) as Pl
,SUM(Win) as W
,SUM(Draw) as D
,SUM(Loss) as L
,SUM(F) as F
,SUM(A) as A
,SUM(Total) as Tot
,ROUND(AVG(GPG),2) AS GPG
[code].....
View 2 Replies
View Related
Feb 1, 2007
OBJECTIVE:THE QUERY SHOULD GIVE ME THE FIELDS I MENTIONED IN THE FIRST QUERY WITH THE CONDITIONS BELOW.
CONDITION 1: RateReview field should have yesterday's date
CONDITION 2: Email will be send to customer only once so Customer_GUID is UniqueIdentifier
CONDITION 3: Customer shouldnt' have opted to get out from receiving any email so Termination field should be NULL
ONe Customer can have many transwactions
Is there any way i write the code specifying that no email should be sent more than once evereven if customer buys 10 tickets.
Only one email sent so i need to specify that if this email has gone to particulare CUSTOMER_GUID then Ignore that record and
do not send any email. This would be done by some tool known as StrongMail.
SELECT
CAST(a.Transaction_GUID AS varchar(36)) as Transaction_GUID,
CAST(a.Customer_GUID AS varchar(36)) as Customer_GUID,
Film_id as MovieId,
First_nm as FirstName,
Last_nm as LastName,
Email_nm as EmailAddress
FROm
Table1 where RateReview_dm >= dateadd(day, datediff(day, 0, getdate()), -1) -- Greater or same as Yesterday day
and RateReview_dm < dateadd(day, datediff(day, 0, getdate()), 0) -- Less than today's date
and
and Terminate_dm is null
(I don;t know what condition to give that same customer good should not be send email again if send once)
i don't know whether i need to create a derive table or it can work without drive table
Cananyone help me with this query please
View 2 Replies
View Related
Jul 20, 2005
I've created this:SELECTc.ProjectID,Count(c.ID) as 'Registrants',Count(dt.Hits) as 'Submissions'FROMCME_TBL cJOIN(SELECT ProjectID, Count(*) as Hits FROM CME_TBLWHERE evalDate Is Not NULL OR testDate Is Not NULLGROUP BY ProjectID) dtON c.ProjectID = dt.ProjectIDGROUP BYc.ProjectIDORDER BYc.ProjectIDand I get this:ProjectID Registrants Submissions--------- ----------- -----------adv_104699 99adv_1047185 185adv_110566 66boh_107134 34Instead, I want this:ProjectID Registrants Submissions--------- ----------- -----------adv_104699 14adv_1047185 82adv_110566 17boh_107134 12The "ProjectID" and "Submissions" columns are produced when I run thederived table (dt, above) as a standalone query. By the same token,the "Project ID" and "Registrants" columns are produced when I run the"outer" query, above.Am I on the right track here?TIA,-- Bill
View 6 Replies
View Related
Jul 20, 2005
Hi all,I have a table in this formatcolname1 colname2 colname3col1data1 col2data1 col3data1col1data2 col2data2 col3data2col1data3 col2data3 col3data3col1data4 col2data4 col3data4I want to display it in this formatcolname1 col1data1 col1data2 col1data3 col1data4colname2 col2data1 col2data2 col2data3 col2data4colname3 col3data1 col3data2 col3data3 col3data4Basically rotate it through 90 degrees clockwise and flip it over :)I'm pretty sure this is done by using a crosstab query and or aderived table or temp table. The problem is I use a crosstab query toget the original data into the first format. I've been strugglingtrying to get the ouptput into the second format for over a day nowand just can't seem to get it to work. Can anyone give me any pointerson the general solution to this?I hope this makes sense. Thanks for the help.
View 4 Replies
View Related
Feb 7, 2007
I have an application that has two different database backends, one is SQL Server Compact Edition and the other is SQL Server. The reason is because the application may run at home on one of our sales agent's computers or here in the office.
I have a query that uses a derived table and works just fine in SQL Server, however when I run it in the compact edtion (having the exact same table structures) it will not run. My question is...does the Compact Edtion or the Mobile Edition allow derived tables. If not is there a way to work around this? I will happily give an example if it will help.
Thank you,
Adam
View 10 Replies
View Related
Jul 31, 2007
I have some questions on derived table. Below is my situation.
Table order, there are 40 columns and it has indexes for productID and addressID
Table product, there are 15 columns and it has index for productID
Table address, there are 20 columns and it has index for addressID
Query A
-------
select C.address, C.area, B.productname, B.category, A.qty, A.price
from order A
join product B
on A.productID = B.productID
join address C
on A.addressID = C.addressID
Query B
-------
select C.address, C.area, B.productname, B.category, A.qty, A.price
from (select qty, price, productID, addressID from order) A
join (select productID, productname, category from product) B
on A.productID = B.productID
join (select addressID, address, area from address) C
on A.addressID = C.addressID
Will I loss the indexing when using derived table?
Why query B performance is much better than query A?
Thanks.
View 5 Replies
View Related