Querry 2 Detect Doubles In A Table
Jul 6, 1999
Hi,
I have a table which contain a field called 'company' of type 'int'.
I want to make a querry which returns all doubles ... for example:
I have: after querry the return must be:
company company:
1 1
3 3
3 3
11 3
7 2
3 1
2 2
1
4
2
5
Thank you,
Sebastian
View 1 Replies
ADVERTISEMENT
Jan 29, 2008
I made a DDL change to a published table. To do this, I had to remove the table from the article, modify two field sizes, save the table, and then add the table back to the publication. I did have to rerun the snapshot agent after this even though the new article is exactly the same (yes, I understand all rowguids are dropped and recreated).
So, at the subscription, I begin synchronization and it replicates every article, thus doubling the size of the subscription .sdf file. yes, it can be compacted and it cuts it back in half.
Question is how to prevent this behavior? Is it possible to create the rowguid before publishing the table/article and that way even if you go back and make a schema change that requires republishing you can avoid the nasty behavior of producing a new snapshot and and a doubling of subscription database size?
This particular merge publication is read-only. Every article is marked as 'download only.'
Ideally if schema change is needed to one table, I only want that table/article to require reinitialization.
Actually, if its a simple change like expanding a varchar by some chars I'd like to not have to republish the article at all.
keep dreaming?
View 1 Replies
View Related
Oct 29, 2005
Hi,I want to check with VB.net whether a field in a SQL-table is NULL or not.This code doesnot work:If xxx = NULL then<statements>End IfI got the error, that NULL is not supported ?How do I code the check ???Help is appreciated, Gr.
View 2 Replies
View Related
Jul 22, 2006
hi, good day, i facing a problem
Code:
CREATE PROCEDURE [SP_TEST]
AS
SELECT *
INTO #TMP_CUSTOMER
FROM O_CUSTOMER
-------------------------------------------------------------------------
SELECT DISTINCT
COUNT(CUST_CD)
FROM
#TMP_CUSTOMER
GO
when i run in query analyzer , using "exec SP_TEST" , it work and display result
but when run
Exec Master..xp_CmdShell 'bcp "exec mydbtest..SP_TEST " queryout C:TEST.TXT -c -Slocalhost -Usa -Ppassword'
it give error "SQLState = S0002, NativeError = 208"
and show
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name '#TMP_CUSTOMER'.
thanks for guidance
View 4 Replies
View Related
Jul 27, 2006
Hi,
Regarding to my previous post at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=553652&SiteID=1, just wondering if there's a way to detect any changes which is made on the existing indexes in a published table so that the device can determine whether reinitialization of subscrption is needed before every synchronization.
Cheers,
Justin
View 3 Replies
View Related
Mar 27, 2006
What is the best way to detect that a sqlserver table row has foreign keys and cannot be deleted?Thanks,Keith
View 1 Replies
View Related
Jul 20, 2005
Hopefully someone can at least point me in the right direction for moreresearch (e.g.: correct terminology). My only previous experience was justdumping data into a database using ODBC, and that was some years ago so nowmostly forgotten.I need to write an NT Service/Application (in C/C++) that will be gettingdata sent to it via SQL Server 2000. The data will arrive in my SQL Server(read-only access), via replication of tables from another remote SQLServer.My application needs know when new row are inserted, or updated so it can toread this data (needs to be quick/timely so hopefully no polling) to theninterface with other remote proprietary systems.T.I.A.PS: If you can recommend appropriate books on SQL Server 2000 that wouldalso be useful.
View 2 Replies
View Related
Jan 2, 2008
Hi, I wonder where I can see last update over a table. Maybe sqlserver write some information about every table.
For example there are 300 tables in a database an I want to execute some query to see the last tables updated (list of tables updated > 2008-01-02 )
Hope to be clear,
Best regards
Ariel
View 4 Replies
View Related
Aug 25, 2005
Is there a way I can frame the querry for the following scenario??
column1
--------
item1
item2
item3
...
..
Querry: Select datediff(month,item1,item2) and next for item2 and item3...
Thanks
View 3 Replies
View Related
Nov 12, 2007
Hello. I know, you think I'm totally clueless, and you're right. SQL is the most confusing thing for me but I must learn it.
So, I am running a query to find out the name of the person who sold the most stoves with the least color purchased. I have ran that query and it works . My problem is that I have to add to that query another column that counts the number of stoves sold, instead of having them displayed one by one. My query is as follows:
SELECT EMPLOYEE.Name,STOVE.Color FROM INV_LINE_ITEM, STOVE, EMPLOYEE, INVOICE
WHERE INV_LINE_ITEM.FK_Stovenbr=STOVE.SerialNumber
AND INV_LINE_ITEM.FK_InvoiceNbr=INVOICE.InvoiceNbr
AND INVOICE.FK_EmpID=EMPLOYEE.EmpID
AND STOVE.Color IN (SELECT CAST(MIN(Color) AS CHAR(5)) 'Min Color' FROM STOVE)
AND EMPLOYEE.Name IN (Select CAST(MAX(Name) AS CHAR(15)) 'Employee Name' FROM EMPLOYEE)
ORDER BY EMPLOYEE.Name, STOVE.Color
Thank you
View 3 Replies
View Related
Feb 18, 2008
I have a single table and I want to check for the duplicates. On the bases of two column.
Namley HiNum, Procode.
so if there are duplicates I want to print out those records
How I can do that in a script.
I tried the following codes but I am getting an error. how I can fix it. Or this is completly wrong?
.
Select * from Claims Where HiNum in (Select HiNum,Procode,Count(*) as NumberOfRows
From Claims
Group by HiNumber, Procode
Having Count(*) > 1)
View 2 Replies
View Related
Mar 16, 2007
Hello
Can anyone give me the code to insert date from textbox to database(SQL Server 2000). The date fromat in SQL is dd-mm-yyyy.
Rathish
View 3 Replies
View Related
Oct 29, 2007
Hi! I 'd like to update the database..I 'd like to update the same field, the first update would set all to 'No' and the second update woyuld set specific records to 'Yes':
1) "Update tblDept SET IsTop ='No'
2) "Update tblDept SET IsTop = 'Yes' WHERE id = 200 "
Cheers!
View 4 Replies
View Related
Nov 12, 2003
Hi.
I know this querry:
"SELECT TOP 10 * FROM MyTable ORDERBY ..."
will give the top 10 rows.
But how can I build a querry that can get the rows from 40-50 (ie).
Thanks.
View 2 Replies
View Related
Jan 21, 2005
I have two tables linked with the colunm name systemId and I need to get all the systems responding to the condition (t1.software & 0000000001) = 1 and if they have any contacts I would like to see them.
Here is what I have for the moment however my querry do not return the system info if no contact exist and that is wrong.
select customers.customerId,customers.systemId,customers.country
from customers,contacts
where (customers.software & 0000000001) = 1
and customers.SystemId = contacts.SystemId
order by customerid
Systems
-SystemId
-CustomerId
-Name
...
Contacts
-ContactId
-SystemId
-Name
-Tel
...
View 1 Replies
View Related
Aug 29, 2005
I have created a small querry and for some reason my container (datalist) is not reconizing the company name This is also the first time that i have created a querry with two select statements in the sproc.... Does it make a difference if there is two select statements in a querry?? When populating a datalist?Not sure if i need to seperate the two statements some kind of way..
Is this ok to use with datalist? Erik.. ALTER PROCEDURE Get_Information_For_Datalist_Global_ @IDProduct AS INT, @IDCompany AS INT AS SELECT Product.ProductName, Product.ProductID,Product.ProductImage, Product.ProductDescription, SprocsTable.* FROM Product INNER JOIN SprocsTable ON Product.ProductID = SprocsTable.ProductID WHERE Product.ProductID = @IDProduct SELECT Company.CompanyID, Company.CompanyName FROM COMPANY WHERE COMPANY.COMPANYID = @IDCompany
View 1 Replies
View Related
Dec 7, 2006
is there a way to get the time that it takes a querry to run like down to the millsecond
View 2 Replies
View Related
Jan 26, 2008
hi.
i want to have a text box and command button. i will be entering the clients id in the text box and press the command button to search the clients record. this will be search query. i have done that previously in vb6. but dont know what query to write in vb08. Any help. thks.
View 1 Replies
View Related
Feb 22, 2008
Is there a way to display my querry horizontally?
View 2 Replies
View Related
Dec 29, 1999
There are 3 servers in our group which the Local Enterprise Manager Tool is giving us an error when we try to view local DB table data by right-clicking on the table and selecting return all rows... we get this error I thought this was a permissions error but as far as I know we haven't played with the permissions. This seems to be a common ailment here... does anyone have a fix for the EM tool.
An unexpected error happened during this operation.
[Query] - Query Designer encountered a Query error:
Unspecified error
View 2 Replies
View Related
Jun 18, 2006
I have two database on same server. I want write a querry, witch qering the data from 1st database, than create a new table on the 2nd database.
But the in clause after the into clause permanently generate error.
Here is the query€™s little part:
Select €¦..
into Backup in €™Test.mdb€™ from €¦
I try wrote other ways
in €™Test€™
in €™dbo.Test€™
in dbo.Test
but none of them work
its only work, when i not want pass for the second database
How can i pass the result for the 2nd Database
View 11 Replies
View Related
Sep 21, 2007
Hi,How to run a DTS from query analyzer using some t-sql commands??? Is it possible?? What is the command to run a DTS from QA???and What are the possible ways of running a DTS?? from how many types we can execute a DTS like 2 of it i know from EM directly and from the help of Schedule jobs.
View 1 Replies
View Related
Nov 8, 2007
Dear all,
I have 2 SQL store procedure which are suppose to return similar number of data.
For an unknown reason one of the procedure is returning lasse data than the other.
in order to dig out the reason for that I need to compare the two set of data return by both procedure.
one by one is a huge woek has I have more than 1000 records.
So my question is that what is the easy way to extract data which has been forget or miss ?
For example
my procA return 500 rows
my procB return 400 rows
I would like to identify the 100 records which are in ProcA results but not in ProcB results
In other words extr^ct the difference between A and B
thnaks for your help
serge
View 5 Replies
View Related
Nov 24, 2006
Hello,
In SQL if we want to edit a row in a table then we have two ways to do the same,
1. Execute a command to Update the records in sql through querry analyzer.
2. Go to enterprise manager and then open the table and update a new row.
But can't we do the editing in the querry analyzer is there any way to do this.
That means i select all the records from my table using the following querry.
Select * from MyTable
and then performs editing in the querry analyzer without executing any update command and without using the Enterprise manager.
Can we do this????????
Bye and TC
View 6 Replies
View Related
Feb 3, 2008
hi.
i have created a database with a table called customer. hav a field which displays the date. how can i add a query on the date picker so that when i choose a date on the calendar i can view the customers details. in other display the record by choosing a particular date.
thx.
View 9 Replies
View Related
Mar 6, 2008
i lost my laptop driver's cd,right now i am using windows XP professional.and laptop is of compaq v3000.
so from where i get my laptops driver,can you help me out .?
View 1 Replies
View Related
Nov 22, 2006
Hello,
Need a bit of help here. In one table i have my production data on some wheels. Each time the wheel is touched, it gets smaller. Then in another table I have the primary data of that wheel, ie price vendor, make model and scrap diameter.
What I'd like to figure out is, In one month, what was the wheel size to start off, what is the end size to give me a total size used during that month. If i could get that, then I think I would be able to figure out what the price cost for useage of that wheel was for the month.
Any help?
Thanks Brian
View 3 Replies
View Related
Aug 15, 2000
hello!
can somebody tell me how i can redirect the result of my
select statement to a file.
thank's
View 1 Replies
View Related
Dec 20, 2006
Hi.every one. I have a problem when I use this querry
select replace(Title,'.','')AS Title1, ID from tbl_Sim Where Title1 LIKE '%377%'
And here is my record
Title : 0988.613.775
ID : 2
and here is the error: Invalid column name 'Title1'.
Can any one show me how to run this querry, I want to TRIM the 'Title' before it can be compared with another condition
I am a beginner. Thanks alots!
View 2 Replies
View Related
Sep 17, 2007
Hi,
I am writing the following querry.
Code Snippet
Select dbo.fn_EnGiftId(116) AS 'EnGiftId', dbo.fn_DeGiftId(''+ EnGiftId +'') AS 'DeGiftId'
But the above querry giving me the following error When i am executing the querry:
Code Snippet
Server: Msg 207, Level 16, State 3, Line 1
Invalid column name 'EnGiftId'.
The scenario is I have created two functions 1st is for encryption of GiftId and 2nd is for Decryption of the Encrypted Giftid.
But in the same select querry i want to use the name of column which i have given to the encrypted data in the selct querry i want to use that same column name in the decryption function uin the same querry.
When i am executing the below querry it gives me the required output. So Why not above querry.
Code Snippet
Select dbo.fn_EnGiftId(116) AS 'EnGiftId', dbo.fn_DeGiftId(''+ dbo.fn_EnGiftId(116) +'') AS 'DeGiftId'
i d't want to write the encryption function again and again. Is theer any way to avoid this.?????
View 5 Replies
View Related
Apr 2, 2008
Hi,
I linked my Active Directory catalog on my local machine as linked server. Next I querry this server, and it works pretty.
I have problem in similar situation when I linked AD as linked server on other machine and when I querry AD it yields error:
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "
SELECT cn, mail, sn, co, distinguishedName, displayName FROM 'LDAP://DC=<domain>,DC=com'
WHERE objectClass = 'user' AND objectCategory = 'Person'
" for execution against OLE DB provider "ADSDSOObject" for linked server "(null)".
What is wrong?
View 1 Replies
View Related
Nov 20, 2003
I am new to ASP.NET and met a problem about access a database on a Web Server (www.myserver.com). My meaning here that I created a .sql from my localhost to test, but when to upload to my web server on the internet, an error occured: "System.Data.SqlClient.SqlException: SQL Server does not exist or access denied".
Anyone here can help me to solve my problem. Waiting for your reply soon. Thanks
View 2 Replies
View Related
May 16, 2007
hi,
I'm creating my first report.
I do "new project" > "report server project".
Thereafter I create my shared datasource.
Thereafter I try to add a new report.
It ask to enter my querry.
I've built up my querry previously with the querry analyser in SSMS, and there it runs quite fast.
But when i copy-paste the querry in the reporting designer, and i choose to preview it, it takes more then 20 minutes.
however, my querry it quite big, but i've written querries ten times larger in my life.
(it's about 50lines: 10 querries, union-ed together and in each one i have 4 innerjoins.... all tables are even almost empty, so it's not that indexes are missing or whatever)...
is it known that in the report designer querries are much more slower????
View 3 Replies
View Related