Quantcast
Browsing all 23857 articles
Browse latest View live

Numbering

I am trying to generate sequential numbering for each row insertion starting from 182.  I have table Mocha INSERT INTO mocha SELECT (SELECT 182) +1,[site_id],'fake@email.com',[Phone #]...

View Article


Transact-SQL Changes

I would like to know if there are changes in T-SQL from SQL 2005 to SQL 2012?

View Article


Update Statements using SQL

Hi, I have a table 'ABC' and a stored procedure which updates 'ABC'. I update the table 'ABC' every week some times monthly. Instead of updating the complete table is there any way we can update stored...

View Article

Remove last Comma from the string

Hi All, I have one field with different values like F1A,B,C,D,EG,H,I, My requirement is  to remove the last comma from that string. I need the output should look like F1A,B,CD,EG,H,I thanks,Mears

View Article

Find the tables used in a SP

Example: Create proc SQL AS Begin   CREATE TABLE #temp      (         Name varchar(14),          Num varchar(9),          SSN varchar(9),          req int,          VN varchar(12),          PayrunDt...

View Article


Roll back the updated records

One of our application users accidently updated approximately 1000 records of one of our Production Database tables .There are 3-5 records usually added /modifiled to this table per day .we also...

View Article

Pivot Table without Aggregate?

I am trying to write a query that lists the Employee assigned to Roles for the selected Projects.The information is stored in 3 separate Tables with one table that links the 3 together.[Project] Table,...

View Article

Changing a text value in a column to a number, then using SUM to get the total.

SELECT TOP (100) PERCENT dbo.department.name, COUNT(dbo.Nurses.id) AS Expr1, dbo.Degrees.name AS Expr2, CASE dbo.Nurses.jobstatus WHEN 'FT' THEN 0.90 WHEN 'PT' THEN 0.60 WHEN 'PRN' THEN 0.30 END AS...

View Article


what is with this query

"insert into Subject_Content (Subject_id,Content) values('"+subject+"','"+ConcateData+"')" this query is not excute

View Article


Help with Query

I have this table in ms sql server 2008:                                                                                                                                         NAME       INFO...

View Article

AFTER INSERT and AFTER UPDATE triggers on same table

 Hello,I have a table "T" and 2 triggers on that table: TR1 and TR2. TR1 is an after insert trigger and TR2 is an after update trigger. The problem is that when TR1 executes an update on column "x" of...

View Article

Updating a chain of records by a CTE - SQL Server 2005

Hi,I've the following SQL Server 2005 table:CREATE TABLE [dbo].[WOr]( [WO] [varchar](10) NULL, [WO_Parent] [varchar](10) NULL, [WO_Group] [varchar](10) NULL ) ON [PRIMARY]with these test values:INSERT...

View Article

OpenRowSet Fails

ss2008 R2I can execute a simple query with my openrowset, and even execute a stored proc which executes a simple query which returns a result set.  But if the proc inserts rows into a table datatype,...

View Article


OpenRowSet Issue

Hi, I am trying to access remote db server's stored procedure and am using openrowset for that. i am aware of that i can use linked server. but due to some reason my customer doesn't want to use that....

View Article

Trying to calculate a relative percentage over a set

Here''s the SQL that I came up with (it doesn't work);with cte as (select COMPANY as COMPANY, [INDEX MARKET CAP] as IndexCap, Count ([INDEX MARKET CAP]) as CountOfRates from...

View Article


need to convert data in multiple rows with same ID into 1 row with multiple...

Can somebody help me on below scenarioI am hoping to run a procedure that pulls data organized as follows:Email | Preferenceemail1 | PreferenceXYZemail1 | PreferenceABC And render it in a table like...

View Article

Split Rows in to another set as columns in sql ?

Hi,I have a sample data..IdENAMEGRADE1MILLER         22CLARK          43KING           74ADAMS          55FORD           16JAMES          67MARTIN         108ALLEN          39BLAKE          810REDDY1I...

View Article


Indexes???

--New ALTER TABLE dbo.EventTracking ADD CONSTRAINT XPKtblEventTracking PRIMARY KEY CLUSTERED ([Object_ID]); CREATE UNIQUE INDEX unci_tblEventTracking ON dbo.tblEventTracking ( eventDate, eventID,...

View Article

Deleting records from Self-Referencing Table

I am using this query to dodge the foreign key error when trying to delete a record from a table that has primary key and referencing foreign key in the same table. It works with smaller set of data...

View Article

PIVOT on dates in year

I need to be able to create a multi-column PIVOT in order to show values for the same LabDate and LabID for 1 or more dates in a year.  When a patient visits a lab on a specific date (LabDate) we...

View Article
Browsing all 23857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>