I Need Sql Small Query

Mar 10, 2007

in my table have two column one post(varchar) and another one views(decimal).in table have no.of data's.......
sample data's

Ex i want this Result
post views post views

std 400 std 400
abc 100 abc 100
dbn 10 sdfe 75
sdfe 75 dbn 10
.... .....
..... ....
....


i need one query....... condition view best top 10 post based on views column

View 2 Replies


ADVERTISEMENT

How To I Enter A Small Square Or A Small Circle In A NVARCHAR Field?

Dec 25, 2006

I want to store a small cirle in a text field. Can anyone tell me how I can enter it in ascii code.

Thanks

View 4 Replies View Related

Small Query

Sep 12, 2007

Hi,

I need to display only the char having start with 'ACCT -AMOUNT',Now problem is that some records having the lower case character like 'acct amount'.
But i want to display only the upper case char start with 'ACCT-AMOUNT'.

I have to used the 'like ' statement but it is showing all the row inculding the lower case also.

Please give me some clue reg. the issues.

Thanks,BPG

View 3 Replies View Related

A Small Query Problem

Feb 15, 2008

Hello All,
I have a database and I am trying to run a query against it, it returns the data fine, I just want it displayed differently. Here is the example; I am a novice at SQL I dabble here and there so any help would be great!

Base Code
Select LOA.Account0 as 'Account Name'
From local_accounts LOA
Where LOA.Account0 like '%Microsoft%'
Group by LOA.ACCOUNT0


Account Name
Win32_UserAccount.Domain='Microsoft',Name='Jason'


I would like the data to be displayed differently in my query. I would like just the domain user name to appear in the row.

Account Name
MicrosoftJason

Does anyone have example code of something like this.

View 1 Replies View Related

Small Query Problem

Mar 7, 2008

my query is :

select * from category where parentid =6

this gives me all children of number 6, I wanted to select name of cat 6 as well.

Please help me out

View 12 Replies View Related

Slow Performance With A Simple Query In A Small Table?

Jul 9, 2001

In my database/MY SERVER (SQL7/Win2K), I run a simple query with a Table/10000 rows (without cluster index):
SELECT * FROM TABLE
it take over 30s. Why it's slow? How can I check for reason? How to configure my server to improve performance?
Thanks in advance.
TH
----------------------------------
SP_CONFIGURE's RESULT in MY SERVER
----------------------------------

Table 'spt_values'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0.
name minimum maximum config_value run_value
----------------------------------- ----------- ----------- ------------ -----------
affinity mask 0 2147483647 0 0
allow updates 0 1 1 1
cost threshold for parallelism 0 32767 5 5
cursor threshold -1 2147483647 -1 -1
default language 0 9999 0 0
default sortorder id 0 255 52 52
extended memory size (MB) 0 2147483647 0 0
fill factor (%) 0 100 0 0
index create memory (KB) 704 1600000 0 0
language in cache 3 100 3 3
language neutral full-text 0 1 0 0
lightweight pooling 0 1 0 0
locks 5000 2147483647 0 0
max async IO 1 255 32 32
max degree of parallelism 0 32 0 0
max server memory (MB) 4 2147483647 2147483647 2147483647
max text repl size (B) 0 2147483647 65536 65536
max worker threads 10 1024 255 255
media retention 0 365 0 0
min memory per query (KB) 512 2147483647 1024 1024
min server memory (MB) 0 2147483647 0 0
nested triggers 0 1 1 1
network packet size (B) 512 65535 4096 4096
open objects 0 2147483647 0 0
priority boost 0 1 1 1
query governor cost limit 0 2147483647 0 0
query wait (s) -1 2147483647 -1 -1
recovery interval (min) 0 32767 0 0
remote access 0 1 1 1
remote login timeout (s) 0 2147483647 5 5
remote proc trans 0 1 0 0
remote query timeout (s) 0 2147483647 0 0
resource timeout (s) 5 2147483647 10 10
scan for startup procs 0 1 0 0
set working set size 0 1 0 0
show advanced options 0 1 1 1
spin counter 1 2147483647 10000 10000
time slice (ms) 50 1000 100 100
two digit year cutoff 1753 9999 2049 2049
Unicode comparison style 0 2147483647 196609 196609
Unicode locale id 0 2147483647 1033 1033
user connections 0 32767 0 0
user options 0 4095 0 0

Table 'spt_values'. Scan count 43, logical reads 108, physical reads 0, read-ahead reads 0.
Table 'sysconfigures'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 2.

View 4 Replies View Related

A Small Problem

Aug 6, 2005

How to retreive the value of last identity has been updated in a database (SQL Server)?

View 1 Replies View Related

Small Doubt

May 29, 2008

in command promt how to come out c drive to d drive

View 2 Replies View Related

A Small SQL Puzzle

Sep 26, 2007

Hi,Probable there is a simple solution for this, hopefully someone candirect me in the right direction.I have a table with a persons firstname, lastname, birthdate andaddress. However, I want to select only one person per address, namelythe eldest of all persons living on the same address.Can anyone provide me a solution?Thanks in advance.Duncan

View 2 Replies View Related

Small Problem

Jul 20, 2005

HelloI have a case where Partners are some kind of Super-Users and arestored in a SQL Server database. Best is IMO to put both in the sametable:table Customers:CustomerID[pr.key][blabla]PartnerIDBut of course I have to reference the partnerid from another table andI want SQL Server to maintain the integrity rules. I could splitCustomers en Partners into different tables, but that would not bewise i think.Or I could just reference the CustomerID from the other table and-know- that we are talking about a partner, but in that case it itpossible to reference a customer that is not a partner, and i want toavoid that.Any ideas?Freek Versteijn

View 4 Replies View Related

Small List Of How Do I's

Nov 27, 2007

Consider a recordset consisting of
Vendor, Invoice, InvAmt, Item,ItemAmt
1, 'A12345', 100.00,'Item1', 25.00
1, 'A12345', 100.00,'Item2', 50.00
1, 'Z22222', 200.00,'Item1',100.00

1, 'Z22222', 200.00,'Item3', 50.00
2, 'A12345', 300.00,'Item4,' 250.00

I have a report that groups by vendor and then by invoice within a vendor.

I want to create a report totals that contains

Number of vendors=2
Number of invoices=3
Total Inv Amounts=600.00
Total Item Amounts=475.00


How?
Number of vendors is =count(distinct vendors) ??
Cant do that for # Invoices because of possible duplicate invoices used by different vendors.
How do i get the total invamt? Each occurrence of the invamt fld is in a list2 as =first(invamt).
I really need the sum of each first(invamt).

Thanx Up Front.
Jerry C

View 9 Replies View Related

Small Prob

Aug 17, 2007

i need to concatenate this two database fildes

PATNT_REFNO_NHS_IDENTIFIER defined as varchar
PATNT_REFNO defined as numeric

out put of these tewo colomns like

PATNT_REFNO_NHS_IDENTIFIER = NPA0123
PATNT_REFNO = 0125487


so i need to get a result like
NPA01230125487

any idea

regards
Niranga

View 1 Replies View Related

Small Version?

Jun 18, 2007

I currently use JET 4.0 as my database in a small app I distribute. SQL Server Express is way way too big to distribute. I am looking to move to a better database.

Is there a version of SQL that gives simple database CRUD support, but is super small to distribute? I am also considering Firebird as it's a full database and only 3MB on the client as an embedded tool.

Ian

View 1 Replies View Related

Small Question

May 22, 2006

i have table cosists of 3 columns
i need to select multiple rows from the table
example : i need to select rows with id=(1,5,9,7,11,15,20,23,42,65) in one select statement
can any body answer me?
and i will give him a( )

View 3 Replies View Related

SQL Or Access For A Small Forum

Jan 18, 2004

Hi,

I'm just about to launch a forum, and right now its built in ASP classic with an Access db. I origianlly used Access because most hosts charge extra for MS-SQL server. Recently I switched to Jodohost who offers Access, MS-SQL and MySql for at no additional cost. So now that I have the option, I would like to pick the best solution before I launch.


* My questions are...

- What is the best db solution to go with for a currently small forum?

- How problematic do you think a data migration would be in the future if I stayed with Access for now and upgraded to MS-SQL with a full forum?

- Is it just smarter to go with MS-SQL now, with an empty forum, regardless of any preformance issues because potential migration problems are a greater risk?

- At what point does the speed of MS-SQL at high volumes over come the potential lags in accessing MS-SQL if it is hosted on a different machine from the one hosting the webpages?



* And please keep in mind...

- I have no db training. I can muddle through Access well enough, but administrating MS-SQL I think might be another story

- This fourm will start off very small, but could grow to be quite large

- I may not stay with jodohost, and would therefore likely have to pay more for MS-SQL (which I woudl rather not do)

View 1 Replies View Related

Please Help With Small Table Design

Mar 10, 2004

Hello, could someone pls help me with this table design.

I have a project table and a code table. The code table has things like priorities (High, Medium, Low).

Now, I want all projects to be able to use these 'global' codes as well as define their own. So, they could define their own priority code 'Critical', that only their project can see.

Any help would be great.

View 1 Replies View Related

Please Help With This View - Small Modification

Nov 17, 2005

I have listed a view below and a portion of the result set that is returned when I run the code in Query Analyzer.  This is part of a timesheet application that logs hours per SCHLSTUID per SECTIONID per week.  This returns the SCHLSTUID(user's ID), SECTIONID, Date that the week starts, the first date that time was logged.  The user could be in several SECTIONID's for the same week.  I need to modify this so that it returns the date that the first time was logged for any of the SECTIONID's per week.  I know that this is probably something simple that I'm overlooking but I just can't get it to work correctly.Example:  SCHLSTUID   SECTIONID   ATTSTARTDT                     FirstTimeEnteredDOn601868445      EN4AR001      2005-09-18 20:59:21.120    2005-09-19 20:59:21.120601868445      MAA1R001      2005-09-18 20:59:21.120    2005-09-18 20:59:21.120This would need to return 2005-09-18 20:59:21.120------------------------------------------------------------------------------------------------------601868445      EN4AR001      2005-10-02 20:59:37.427    2005-10-02 20:59:37.427601868445      MAA1R001      2005-10-02 20:59:37.427    2005-10-02 20:59:37.427This would need to return either 2005-10-02 20:59:37.427------------------------------------------------------------------------------------------------------601868445      EN4AR001      2005-10-09 20:59:37.823    2005-10-09 20:59:37.823601868445      MAA1R001      2005-10-09 20:59:37.823    2005-10-13 20:59:37.823This would need to return 2005-10-09 20:59:37.823----------------------------------------------------------------------------------------------------------------------------------------------------CREATE VIEW dbo.vExportStartWeekASSELECT     TOP 100 PERCENT schlstuid, sectionid, ATTSTARTDT, MIN(TimesheetDate) AS FirstTimeEnteredOnFROM         (SELECT     schlstuid, sectionid, ATTSTARTDT, ATTSTARTDT AS TimesheetDate, sunmns AS TimeEntered                       FROM          TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, ATTSTARTDT AS TimesheetDate, sunhrs AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 1, ATTSTARTDT) AS TimesheetDate, monmns AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 1, ATTSTARTDT) AS TimesheetDate, monhrs AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 2, ATTSTARTDT) AS TimesheetDate, tuemns AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 2, ATTSTARTDT) AS TimesheetDate, tuehrs AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 3, ATTSTARTDT) AS TimesheetDate, wedmns AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 3, ATTSTARTDT) AS TimesheetDate, wedhrs AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 4, ATTSTARTDT) AS TimesheetDate, Thrmns AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 4, ATTSTARTDT) AS TimesheetDate, Thrhrs AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 5, ATTSTARTDT) AS TimesheetDate, Frimns AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 5, ATTSTARTDT) AS TimesheetDate, Frihrs AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 6, ATTSTARTDT) AS TimesheetDate, Satmns AS TimeEntered                       FROM         TimeSheetDailyAttendance                       UNION ALL                       SELECT     schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 6, ATTSTARTDT) AS TimesheetDate, Sathrs AS TimeEntered                       FROM         TimeSheetDailyAttendance) TimesheetDatesWHERE     (TimeEntered <> 0)GROUP BY schlstuid, sectionid, ATTSTARTDTORDER BY schlstuid----------------------------------------------------------------------------------------------------------------------------------------------------This is a portion of what is returned:SCHLSTUID   SECTIONID   ATTSTARTDT                     FirstTimeEnteredDOn601868445      EN4AR001      2005-09-18 20:59:21.120    2005-09-19 20:59:21.120601868445      MAA1R001      2005-09-18 20:59:21.120    2005-09-18 20:59:21.120601868445      EN4AR001      2005-09-25 20:59:36.670    2005-09-25 20:59:36.670601868445      EN4AR001      2005-10-02 20:59:37.427    2005-10-02 20:59:37.427601868445      MAA1R001      2005-10-02 20:59:37.427    2005-10-02 20:59:37.427601868445      EN4AR001      2005-10-09 20:59:37.823    2005-10-09 20:59:37.823601868445      MAA1R001      2005-10-09 20:59:37.823    2005-10-13 20:59:37.823----------------------------------------------------------------------------------------------------------------------------------------------------Thank you for any help that you can give me.Scott

View 3 Replies View Related

Sql Small Date Time

Dec 27, 2001

when i insert an empty date from an asp page, sql 7.0 generates a default value 1/1/1900. This is normal. However, I need to know how do I turn that feature off so I would not generate the default value.

Currently, my front in application uses asp--vb scripts. Please help.

I tried assigning a null value to my variant, but sql still generate that default date/time

View 1 Replies View Related

Small Permissions Question

Mar 12, 2001

Hello,
I'd like to confirm something regarding SQL Server account permissions. Is the NT domain admin also a member of the sysadmin role on the local server running SQL Server 7.0 on an NT 4.0 platform?
Thank you

View 2 Replies View Related

Timing Out On Small Update

Jan 24, 2001

I am trying to run a program that works on another site but with a copy of the database(SQL6.5) and the vb front end I keep getting a timeout error.

The vb bit is trying to run an update statement on a table with just over 2000 rows. I cannot amend the vb side because this is an .exe

Is there something I might not have done on the server that could be causing this not to work, i.e configuration issues, bigger logs


Please help!!

View 2 Replies View Related

Massive TRN File, But Small DB

Apr 5, 2006

Hi Everyone,

We have a large and active MSSQL 2000 database. Recently, after a rebuild of the server, we had a problem with the SQL service SQLSERVERAGENT. The service could not start as the service account lost local permission to the registry. During this time, all of the data being sent to the database from our application accumulated into the database .ldf file. By the time we were able to get the service restarted, our .ldf file was approx. 28 Gigs. When the service restarded, the .ldf file shrunk down to regular size,about 40 megs, and the .trx tlog file grew up to 28 gigs for that specific period (new file every hour).

The problem is, the database file (database.mdf) stayed about the same as it was before the service was restarted. When the .ldf transfered to the .trn none of the 28 gigs of data got stored in the database. What does this mean? Perhaps with the service stopped the application using the db saw problems and did not commit the data making it all useless? Or is it possible that the data in the .trn log just needs to be forced to commit to the .mdf???

Is there any way to verify the data in the 28 gig .trn file and figure out if we should get it stored to the database? If yes, how would we go about verifying it, and after that how would we force it to commit to the .mdf file? Am I on the right track here or is it not as I see it??

Thanks!
Mike

View 4 Replies View Related

Small Problem On Replication

May 7, 1999

i have performed all the steps for the replication there are two problems i encounytring
(i) how to check whether the replication is working or not
(ii) can replication on the subscribing server automatically create the table which publishing server is publshing
(iii)please tell me someother forums for sql server
waiting for reply
ashish bhatnagar

View 2 Replies View Related

Small Question About BIT Columns

Jun 17, 2004

1-8 bit columns in a table consume one byte of storage space. That sounds simple and efficient.

If a bit could only store two values, this would make sense. But, a bit can be one of three values: NULL, 0, 1.

How does a NULL-able bit column only consume the storage space of a regular 0/1 bit?

View 10 Replies View Related

Which Is Small And Which Is Large Data

Dec 22, 2014

when to use table variable and temp table. i told the interviewer that when rows is less like hundreds or thousand then use table variable else use temp table.After that he asked that what do u mean by less data or thousand rows may be there are multiple columns involved with that less rows and make a huge data set.

View 3 Replies View Related

Small SQL Querying Question

Nov 16, 2007

I am learning about SQL Server 2005 and the SQL lanquage

Just want to know

what does the "GO" do when used within a query see below

USE [AdventureWorks]
GO
ALTER INDEX [AK_Contact_rowguid] ON [Person].[Contact]
REORGANIZE WITH ( LOB_COMPACTION = ON )
GO
USE [AdventureWorks]
GO
ALTER INDEX [IX_Contact_EmailAddress] ON
[Person].[Contact] REORGANIZE WITH (
LOB_COMPACTION = ON )
GO
USE [AdventureWorks]
GO
ALTER INDEX [PK_Contact_ContactID] ON
[Person].[Contact] REORGANIZE WITH (
LOB_COMPACTION = ON )

Many thanks

I am learning for my MCTS so any hint or tips if you have any please

Rob

View 2 Replies View Related

Best Practice - All Small Or All Caps ?

Mar 26, 2008

Hi,
Which is the best practice ?

1. Writing t-sql in All small (or)

2. Writing t-sql in All Caps

- thanks in advance

View 3 Replies View Related

Small Problem With DateType

Jul 20, 2005

I have simply query:SELECT time_start-time_endFROM table1WHERE [.......]When I run this query, then I see:1900-01-01 00:38:00.0001900-01-01 03:43:00.0001900-01-01 03:02:00.0001900-01-01 04:31:00.000I want to get sum of all this dates and times. How Can I do this?Best regardsBUSHII

View 1 Replies View Related

Insert In Row Small Chunks

Oct 19, 2006

hi,



i have a big table (120 million records) and i want to take all this table and to insert it into another table. since this BULK insert operation can make all kind of performance problem i would like to make the bulk insert via small chunks. the table does not have any idintity.

can someone give me an exapmle with rowcount or with a loop to make each time an insert into select statment and to insert in each time for example 5000 rows.

help is appriciated,

thx,

Tomer

View 2 Replies View Related

Keeping Database As Small As Possible ?

Oct 16, 2006

Hello everyone,



I have a winform application with C# front end and sql express 05 backend.

In this database i have a table that holds manufacturer provided pricing and the manufacturers we work with update pricing constantly.

We have one table called "manufacturerpricing" which we are constantly inserting and deleting pricing records to/from to keep manufacturer pricing up to date. We may insert and delete as many as 2,000,000 records per month into this table.

This works perfectly fine and we have no problems here at all.

But with that being said, I am worried about the size of the database growing out of control due to temporary space etc. The database just keeps getting bigger and bigger.

How do I run some maintenance to keep the database size under control.

I would like to run this automatically from the C# front end so if ther is a stored proc I can call or an C# assembly I can reference that would be ideal.

Any help is greatly appreciated.

View 3 Replies View Related

One Large Update Vs. Many Small

Oct 8, 2007



Hello,

the application will add items into a "bag". That is, the items in one table will refer a record in another table. This will be done in timely manner -- with second or minute delays between adding a new item. There will be up to thouthand of items per bag. The option is to wait until a full bag accumulates and set up all the references at once by using


UPDATE items SET container_ref = bag WHERE id IN [...]

The disadvantage of such all-at-once I see is inability to encapsulate the functionality into a SP -- the problem is to pass a set of IDs. The advantage should be efficiency in terms of total SQL Server load. How mush would it be?

View 3 Replies View Related

Small Clarification On Indexing

Jun 2, 2006

Can come one help me how to disable an index using select query.

View 1 Replies View Related

A Small COUNT() Question

Feb 11, 2007

Hello,

I have a table which contains a boolean column. I need to write a query which returns a count() of all the TRUE occurences and a count() of all the FALSE occurences in this table, in 2 different columns in the result table.

Can it be done?

View 3 Replies View Related

One Large Database Or Many Small....

Oct 23, 2006

Hi Experts

We are debating what is best:

1. To combine all the company's data in one large database, and use schemas and file groups to create logical and physical distribution on drives and namespaces

or

2. Distribute the data into smaller databases with related data - eg. products and product description in one db, Customers in another and orders and orderlines in a third db.



Just what are the pros and cons?



regards

Jens Chr

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved