Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

Creating functions that call to non existing ones

Hi.I have some sql scripts. A couple of them use other functions that I have not created yet, so I get next message:"Cannot find either column “dbo” or the user-defined function or aggregate...

View Article


User names with apostrophes failing in Oracle and SQL

Attempting to pass a name with an apostrophe through and getting ORA-1756. How can I get this to work for my usernames with apostrphes

View Article


Image may be NSFW.
Clik here to view.

SQL Join

I have a Asset table and  a project table associated with it , the project is associated with a county and so is the asset but project can be in couple of counties so we track the county for asset...

View Article

Subquery returned more than 1 value. This is not permitted when the subquery...

IF ( select  COUNT(*) AS COUNT  from(select distinct SUBSTRING(LandRiverSegment,7,19) as riverseg,CBSegid from wsmpv24Reporting.dbo.TblLandRiverSegment ) as a group by riverseg having...

View Article

Query Finding Two Similar Records

Can someone tell me why the following query doesn't work?  Below the query are the results.  I am trying to find 2 similar records from the same table that happen within the same day.  The one for...

View Article


SQL Statement using LIKE and Subquery?

Hi,I have two tables, one table is called "Restricted_Words", the other table is called "Content" .   I have a field called "short_desc" in the Content table and a field called "word" in the Restricted...

View Article

Date Conversion

I have a date in varchar data type in this format "dd.mm.yyyy" how do i change it to a DATE data type?

View Article

Determine Days Since Last Visit

I think I may be overthinking this problem.What I have is a table that consists of membership data including visit dates. For each visit date, I need to determine the number of days since the last...

View Article


How to code DateTime-Literal in SQL Server

Hi, I'm a newbee to SQL Server. I have a very simple question to you experts: How should I code a literal of the "datetime"-Datatype?  For Example in the VALUES-clause of an SQL-statement. I have...

View Article


query help

converting data type varchar to numeric.I’m using the following:SELECT[TRAN_CODE]+', '+[INT_T]+', '+[DESC]+', '+[T_C]+', '+[NORM_TC]   settingsTRAN_CODE – varchar(20)INT_T – numeric(3,0)DESC –...

View Article

1._Strange behavior with UPSERT and Incrementing a count

SQL 2008 R2 and the database has snapshot isolation on if that matters. A third party executes this stored procedure in a multi-threaded application and one of my upsert queries fails to work...

View Article

Retrieve one row from multiple similar values column

So, i have Following table records with repeated name with different emails -EmailDircEmailID Ename Edobharish123@gmail.com Harish Salve 15-10-1989navink87@hotmail.com Navin Keddy...

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


help on update Statement on SAME Rows

I have table TblLandRiverSegment   RiverSegment          CbSegId    EL0_4591_0000       80             EL0_4591_0000        81            XYZ_5570_0017        91           EL1_5570_0001...

View Article

Sql query to add row id without loops

I am aware of the statement SELECT ROW_NUMBER() OVER (ORDER ...But we need more functionality. Can we make the row_number to repeat counting from 1 after a specific field changes in value.  I know how...

View Article


Getting the counts and comparing with the inventory table

Hello All,I have table called data inventory which has 3 columns, ID, TableName and AvailableRecords.ID                 TableName                AvailableRecords1                   ABC...

View Article

BULK INSERT - COMMA DELIMITED FILE TO SQL SERVER FAILS ON ROW TERMINATOR

I am attempting to import a comma delimited text file into sql server using the bulk insert scriptBULKINSERTCSVTestFROM'c:\csvtest.txt'WITH(FIELDTERMINATOR=',',ROWTERMINATOR='\n') However the row...

View Article


Script out - Create Table structure

Hi All,If i rightclick a table and script out, i ll get the create table query as shown below:Create Table Table_name(Column1 Datatype1,Column2 Datatype2)Question : Is there any way to get this Create...

View Article

Implementing OOP inheritance in T-SQL (not an O/R question)

Is it possible to cleanly obtain the inheritance benefit of object-oriented programming in T-SQL? This is not about O/R mapping, which has been discussed to death all over the web, but rather...

View Article

update one table from another when the column names match

declare @people table( avatarkey varchar(36) not null primary key, avatarname varchar(50), prims int, allotment int, lockers int ) --lots of code to fill table update @people set prims=(select prims...

View Article
Browsing all 23857 articles
Browse latest View live


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