Forum

Posts

RECENTLY INDEXED PROGRAMMING SOLUTIONS OF Microsoft SQL Server


Query help  

I am trying to write a select statement to get all requests from a table customerinfo where count of the reqno is greater than 1 and in every unique reqno there should be atleaset one reportid with an Id 1873 and the other reportids can be anything between (456,457,458,459,460)Iam not... Continue Reading
Views : 71
Friday 28th of September 2012

Help on Sql Query  

I am new to writing sql queries. here is my present query select distinct DAY(InvDate) as Date,Location,sum(Inv+St) as Total From InvInfo where (InvDate >= '8/1/2012') and (InvDate Continue Reading
Views : 64
Friday 28th of September 2012

difference between '' and "is not null"  

Today I have come across a strange situation. I tried a code as below select * from table1where field1 is not nullI want all data where field1 is not blank, but the above code... Continue Reading
Views : 40
Thursday 27th of September 2012

Tough Date Query  

I am new to sqlserver 2008R2. I am creating stored proc for an SSRS report.I am trying to get a count of red items for each month end for the last 12 months. I have a date range. Below is what the data would look like for one part number: Continue Reading
Views : 38
Thursday 27th of September 2012

Simple LOOP  

Hi All - I have the following table:USER_ID QTYjsmith 2rbird 4lsantore 1I need the USER_ID to repeat on multiple lines based on the QTY: Continue Reading
Views : 54
Thursday 27th of September 2012

question about procedure  

dear all;I have a quick question. I have the following procedure belowcreate PROCEDURE test( @p_required INT )asselect * from tbl_test twhere t.id = @p_requiredwhat i want is if @p_required is not null or empty,... Continue Reading
Views : 71
Thursday 27th of September 2012

Order By, Sort Field  

Hi, i am new in this forum and also in SQL Database. I have a problem in sorting my record.My query is -> SELECT accessionno FROM tblBooks ORDER BY accessionnoand this is my output:2012-C1-62012-C2-72012-C3-82012-C4-92012-C5-10 Continue Reading
Views : 64
Thursday 27th of September 2012

Decrypt encrypted password  

Dears,I have created a asp.net user through asp.net membership form. Here my question that after I crated this user then password stored as in encrypted text. I need to write a sql query to decryption the password to be a readable password.Below is my code but it give null... Continue Reading
Views : 57
Thursday 27th of September 2012

Slow Query  

select * from tablewhere Column like '' or Column like ' ' or Column is nullthe table has 23 Lakh rowsi have two primary keys in the tablethe query is taking almost 12 minutes to run. Is there a was i can speed this up? Continue Reading
Views : 65
Thursday 27th of September 2012

How to check values  

Sir,I need to check value at 2 mins ..Problem is that I need to check status of user If status of user is same for two miniute then I need to update .how can I check that values for 2 min in sql server . Please suggest me.Thanks &... Continue Reading
Views : 58
Thursday 27th of September 2012

SQL table export to the Excel through sql query  

Dear all,Please can anyone provide me the sample for exporting the table into excel throguh sql query.I tried with bcp and open row set but both did not work.. Continue Reading
Views : 54
Thursday 27th of September 2012

Select Data from table  

Hi AllI have a table structured which comes by executing the Sql query isjob_id--definition_uid--definition_value12--A--12312--B--ABC12--C--BO12--D--1113--A--45613--B--PQR13--C--CG13--D--12214--A--78914--B--DFG Continue Reading
Views : 46
Thursday 27th of September 2012

procedure related  

SELECT tblplsrptextract1.strSpyIDocType AS SPYDOCTYPE , SUM(CASE WHEN tblplsrptextract1.strusriproduct = 'APP-NEW' THEN 1 ELSE 0 END) AS APPNEW , SUM(CASE WHEN tblplsrptextract1.strusriproduct = 'APP-RENEWAL' THEN 1 ELSE 0 END) as APPRENEWAL FROM tblplsrptextract1 Continue Reading
Views : 55
Thursday 27th of September 2012

query optimization for update statement.  

Hi,is it any possible way to simplify this below mentioned query?update Table2 set A=1 where leadid in (select leadid from Table1 where ClientCode = 'A')update Table2 set B=1 where leadid in (select leadid from Table1 where ClientCode = 'b')update Table2 set C=1... Continue Reading
Views : 69
Thursday 27th of September 2012

Unable to connect SQL Server 2008 cluster using IP  

Hello, I have installed SQL Server 2008 Enterprise R2 (64bit) in cluster mode on Windows 2008 Server cluster. when ever I try to access SQL server from via IP address from any of the client, ODBC or from the same server get an error mesasge " Server doesnot exist or access denied" but ... Continue Reading
Views : 70
Thursday 27th of September 2012

Distinct w/Inner Join and other fields  

How do I get just the unique rows (distinct), and more than 1 column/field from table, and do an inner join too?EX: I'd like to know what Rooms have something in them and what the first item in the room is. So the results would be:RoomNum, Room, ItemID, Item 1 ... Continue Reading
Views : 50
Thursday 27th of September 2012

How to develop ETL tool in SQL server  

I am a new to SQL server. I want to transfer the data one database to another database. I don't know how to use an ETL tool in SQL server.chidambaram Continue Reading
Views : 61
Thursday 27th of September 2012

Help With SQL Query  

Hi. I have a staff table and an assignments table. A staff member can have many assignments. I want to query the staff members based on their number of assignments for the month. The staff members should be ordered by the number of assignments from least to greatest. Here's what I'm starting... Continue Reading
Views : 58
Thursday 27th of September 2012

use of operator '%' in sql server  

while was reading one of the old posts here, I came across the code below. I could not understand the use of '%' in this code.link : http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=83637 Continue Reading
Views : 309
Thursday 27th of September 2012

Upate statement inside of a case statement  

I want to update a table using a update command inside of a case statement. Can this be done, here is a sample of my code:Case when e.englishProficiency = (M)then (UPDATE v_ProgramParticipation pp set pp.name = '235012' where personid = '6781') Continue Reading
Views : 50
Thursday 27th of September 2012

Box and Whisker Plot  

Hey Everyone . . .I really hate doing this , but I lack the necessary skills to write this from scratch and have not been able to find query help... Continue Reading
Views : 52
Thursday 27th of September 2012

Max Date Query  

Ok I am out of my league here and I need some guidance. I have done pretty basic queries and stored procedures but I am stuck on this query which is hopefully simple for you guys.Here is the query as I have tried it.SELECT ... Continue Reading
Views : 77
Thursday 27th of September 2012

SOLVED: LIKE operator ([ ] and/or %)  

This works:SELECT emp_fname, emp_lnameFROM EmployeeORDER BY emp_lname ASC;This does not:SELECT emp_fname, emp_lnameFROM EmployeeWHERE emp_lname LIKE '[H]%'ORDER BY emp_lname ASC;(nor does..LIKE 'H%')Normally... Continue Reading
Views : 273
Thursday 27th of September 2012

Query 2 dates values results on same row  

Hi,I have to run a query to get the Treshold values for a range of date.Like--> Select Treshold from table1where([Date] >= '2012-01-01' and [Date] = '2011-01-01' and [Date] Continue Reading
Views : 56
Thursday 27th of September 2012

ISBN 10-->13  

Is there any AS IS script available for converting ISBN10 to ISBN13 into SQL? Continue Reading
Views : 60
Thursday 27th of September 2012

help with case statement  

how can I get the statement to show the dates versus the day..the this query has a union so I had to use an alias (ie Mon); I have only attach part of itSELECT shopcode, ID, EMPLOYEE, SUM(Mon) as Monday, SUM(Tue) AS Tuesday , SUM(Wed) AS Wednesday , SUM(Thu) AS Thursday , SUM(Fri) AS... Continue Reading
Views : 40
Thursday 27th of September 2012

Deploy SQL-Sever Database to a Produtiv-System  

Hello,is there a guide or checklist for deploy SQL Server databases (2008/R2) after development and testing to a productiv/live platform? What are the requirements and permissions it needs, so the topic Deployment, Support, Database update not turn into a nightmare.=> What should I... Continue Reading
Views : 54
Thursday 27th of September 2012

MSSQL Trigger.  

Hello All,I really need some help on how to create triggers in MS SQL.Previously we are using MySQL and now we need to migrate to MS SQL.Can some one teach me on how to create triggers in MSSQL?I have a made a trigger that do thisTableA... Continue Reading
Views : 72
Thursday 27th of September 2012

Select mixed row  

Hi,It is possible to mixed selected row? I have tables ? (it is product recepture for assembly device). DefCREATE TABLE [base] ([heft] INT, [vde] BOOL, [Prumer] FLOAT, [Delka]... Continue Reading
Views : 49
Thursday 27th of September 2012

Error using Bulk insert  

Hi can any one help me with bulk insertBelow is the scenario i have the below codeBULK INSERT CustomerInfo FROM 'C:\CustInfo\Apo(ALL).csv'WITH (FIELDTERMINATOR='\t',rowterminator='\n')When using FIELDTERMINATOR=',' i can upload... Continue Reading
Views : 65
Thursday 27th of September 2012