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

conversion failed when converting the varchar value to datatype int

Hi All,I am summing columns(numeric) together and sometimes there is a negative number so the total row is causing an error.select d.DIVName1 ,c.CCYName1 ,'Foreign Currency Payables' ,SUM(CASE WHEN...

View Article


Getting list of tables with Identity Columns

Hi,I'm new to SQL Server, could somebody help me with the query forGetting the list of tables with indentity columns i.e to check the key info in the system tables along with column data types.Thanks...

View Article


difference between Primary key column and primary key column with identity..

Hi all,Can any one tell me what is the difference between primary key column and primary key column with identity in SQL server??Thanks in advance

View Article

Insert Problem

Hi  All ,I have 2 tablesOrganization and  Customer TableOrganization table columnsorgid it's a primary key not an identity column,firstName ,lastNameCustomer Table First Name,Last Name am issuing this...

View Article

Pivot SQL Text columns

Below is the Data formatTable 1 Table 2Camry_IdMonthYearDealerCamry_Comments Corolla_IdMonthYearDealerCorolla_Comments172013HendrickCamry Comment 1 172013AutoCityCorolla Comment 1272013HendrickCamry...

View Article


OpenData Source Insert

Hi All ,I want to insert data using OpenDataSource function rather than linked server .My requirement is i have 2 tables with same name customers one is in the Dev and other one is in the test server.I...

View Article

Vinculação Access e SQL Server 2008

Boa Tarde.Gostaria de Saber por que quando vinculei meu sistema access com um banco de dado SQL server 2008 meu sistema ficou mais lento do que antes quando a fonte de dado era access.oque devo fazer...

View Article

Where Three columns NOT IN

I have a Table 1.Imp Id    State   landuse   and few other columns1      VA       ABC 2     VA        ABCD 3     VA       ABCD  4     MD      XYZ 5     MD      ABCD 6    MD      ABC 7    PA     ABC 8...

View Article


Another variation on row concatenation

Hi,Suppose I have a table like this:IF OBJECT_ID('dbo.Soils', 'U') IS NOT NULL DROP TABLE dbo.Soils; CREATE TABLE Soils( CHKEY varchar (5) NULL, LAYER1 int NULL, A1 decimal (4, 1) NULL, B1 decimal (4,...

View Article


Want to create partition in a table

Hi,I have a  table Customer  having ID,ProductID,Type as the Unique Clustered index. Now, I need to partition the table based on only Type column. Is it possible to create the partitioned table and is...

View Article

replace select (select count(*) from x)

im tring to replace Select y.ID(select COUNT(y.ID) from x where x.ylID = y.ID)FROM ywith somthing like this:Select y.IDcount(case when x.ylID = y.ID then y.ID else null end ) as 'cnt'FROM yjoin x on...

View Article

Different rules for different values in SQL Pivot?

This works without a problem:PIVOT ( SUM(PremAmount) FOR trans IN ([1],[8],[9]) ) AS pvtIs there a way to have a different rule for different trans codes? For Example:PIVOT ( SUM(PremAmount) FOR trans...

View Article

Extract table from XML variable

I have the following XML and want to extract the data into a table in the format below. Can someone help pleaseStopId   PassID1           12           23           14...

View Article


view

Hi,I created a view .System object status if FalseHow  to turn in to be  True ?thanks

View Article

dymanic cloumns wiith some addtional logic

Hi All,Hi All,   I have a requirement where user want the output where column names would be dynamic .as given structure of table .employee have different department  id with different date.i want to...

View Article


Replace html tags

We inherited a SQL Server database and one of the tables has a nvarchar(4000) column that contains some html markup tags (see example below)<ol type="1"> Enter the following...

View Article

How can I get the negative sign to the right of the number when using CAST to...

Converting a numeric to varchar, using cast...  but, it's putting the negative sign to the left.How can I get it to put it on the right?Also, how can I right adjust the field?

View Article


sp_MSforeachdb don't see my DBs

Hello, all!I made the next query:EXEC sp_MSforeachdb 'IF ''?'' <> ''master'' AND ''?'' <> ''model'' AND ''?'' <> ''tempdb'' AND ''?'' <> ''msdb'' BEGIN PRINT ''?'' SELECT ''?'',...

View Article

Problem with stored procedure

I have a database with two tables, Comics and Summary. Comics contains a list of 1000s of individual issues with each record corresponding to an individual issue, and the columns include a name and an...

View Article

How to SET a variable in CASE statement..

Is there any way to set a variable within the 'THEN' clause in the statement you see below? I just want to increment a variable in this fashion @var = @var + 1 I'm also open to inserting rows into a...

View Article
Browsing all 23857 articles
Browse latest View live


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