SQL 2012 :: Bringing Up A List Of States From Three Columns

Nov 13, 2014

Supposing there are three Columns: Countries, Provinces and States.Then when the user enters “USA” for country, it will bring up a list of states, if they enter “Canada” for country, it will bring up a list of provinces, if they enter another country, it will not bring up any list?

View 2 Replies


ADVERTISEMENT

Only Bringing In Select Columns From A Text File

Dec 2, 2004

Hi all,


I have some bad data that i'm trying to do a workaround for. I have a comma delimited text file with a column which contains a few records that has, gasp, a comma in it. Thus creating an extra column and pushing out NULL values in an empty column that isn't recognized by my DTS package.
Can i fix this?

And if I'm correct in my assumption that I can't, how do I import only the fields preceding the bad data field? When i attempt to do that, I get the following message

'Too many columns found in the current row; non white-spaced characters found after the last defined column's data.'

Blindman, you probably know exactly what to do, huh?

View 14 Replies View Related

SQL Server 2012 :: List Dates In Columns

Nov 11, 2014

I have a table (Event_Table) like:

EmployeeID, CustomerID, Date
1, 11, 2014-11-11
2, 13, 2014-12-10
1, 11, 2014-12-21
2, 13, 2015-01-11
1, 11, 2015-03-02

And now I would like to have a summary with a unique Employee/Customer combination and 3 Date columns like:

EmployeeID, CustomerID, Date1, Date2, Date3
1, 11, 2014-11-11, 2014-12-21, 2015-03-02
2, 13, 2014-12-10, 2015-01-11

Dates should be arranged with the first date in Date1, the next in Date2 and the third in Date3 (if there are forth and more dates I don´t care)

View 2 Replies View Related

SQL 2012 :: Include Columns In Index That Are In Where Clause / Select List And Join

Jun 2, 2014

Usually it is better to include the columns in the index that are in where clause, select list and join.I am thinking that the columns in the selected list is better to keep as index columns and the columns that are in the where clause is better to keep in key columns.Where do we use join column is it better to create as main key column or included column.

View 4 Replies View Related

SQL 2012 :: Number Of Variables Declared In INTO List Must Match That Of Selected Columns

Apr 28, 2015

I am getting error [[Msg 16924, Level 16, State 1, Line 13

Cursorfetch: The number of variables declared in the INTO list must match that of selected columns.]] when i execute below script.

Declare @mSql1 Nvarchar(MAX)
declare @dropuser int
declare @dbname Nvarchar(max)
declare @username Nvarchar(max)

DECLARE Dropuser_Cursor CURSOR FOR

[Code] ....

View 9 Replies View Related

SQL Server 2012 :: Update Statement Bringing Unexpected Results

Nov 25, 2014

I have a simple update statement (see example below) that when runs, I expect to see the number of records updated in the Results tab. This information shows up in the Messages tab; however, what is displayed in the Results tab is (No column name) 40. From where the 40 is being generated. I have tried restarting SSMS 2012, restarting my computer, turning NOCOUNT on and off.

"UPDATE TableA
SET Supervisor = 'A123'
WHERE PersonnelNumber = 'B456'"

View 4 Replies View Related

SQL 2012 :: List All Different Values That Go With Single CAS ID To Appear As Comma Separate List

Jun 15, 2015

So at the moment, I don't have a function by the name CONCATENATE. What I like to do is to list all those different values that go with a single CASE_ID to appear as a a comma separate list. You might have a better way of doing without even writing a function

So the output would look like :

CASE_ID VARIABLE
=====================
1 [ABC],[HDR],[GHHHHH]
2 [ABCSS],[CCHDR],[XXGHHVVVHHH],[KKKJU],[KLK]

SELECT
preop.Case_ID,
dbo.Concatenate( '[' + CAST(preop.value_text AS VARCHAR) + ']' ) as variable
FROM
dbo.TBL_Preop preop
WHERE
preop.Deleted_CD = 0

GROUP BY
preop.Case_ID

View 8 Replies View Related

List Of Columns

Apr 18, 2007

Dear Folks,
Can you please tell me the query to display the columns in a table?



thank you very much

Vinod

View 3 Replies View Related

US / CANADA States Organized For DropDown--HELP????

Oct 30, 2004

I feel real bad asking this...but I have a state table...ordered by State ASC
and it mixes US and Canada, of course. I want to set up a table and a
stproc to produce a dropdownlist that looks like this (as I've seen in many
websites' state tables):

United States --
Alabama
Arizona
...
Canada --
Alberta
...

...and so on, so that the country is listed as a heading with no state code value
and the states each appear in asc order under the country heading. I don't know
how to do this. Does anyone have a good example of how to do this?

Thx much,
reid C.

View 2 Replies View Related

Table With Multiple Serviced States

Mar 8, 2008

I'm creating a database of truckers, which has company name, address, etc. I also want to include which states that they service.

For example:
Trucker A, services California, Nevada, and Oregon
Trucker B, services Nevada and Oregon
Trucker C, services Oregon
Trucker D, services New Mexico

When searching, if I'm looking for a trucking company that services Oregon, I run a search for Oregon, only Trucker A, B, and C will show up, but not Trucker D.

I created a table called truckers, with a primary key of Trucker_ID, put in columns, for company name, address, etc.

Next I create a table for the states, what’s the best way of creating that table?

Would I create a table with 50 different columns, putting in a State_Id column, and then relating Trucker_ID with State_ID, or is there a better way of going about that?

Thanks,

marly

View 3 Replies View Related

Service Broker Transaction States

Mar 16, 2007

WHILE (1 = 1)

BEGIN

BEGIN TRANSACTION ;

DECLARE @ErrorM NVARCHAR(4000),@ErrorNumber INT, @ErrorSeverity INT,@ErrorState INT,@ErrorProcedure NVARCHAR(200);

declare @messageTypeName sysname

declare @ConversationHandle uniqueidentifier

declare @MessageBody xml

declare @ErrorMessage varchar(8000)

SAVE TRANSACTION UndoReceive ;

WAITFOR ( RECEIVE TOP(1) @messageTypeName = message_type_name,

@messageBody = message_body,

@conversationHandle = conversation_handle

FROM [Queue]), TIMEOUT 500 ;

IF @@ROWCOUNT = 0

BEGIN

ROLLBACK TRANSACTION ;

BREAK ;

END ;

IF (@messageTypeName = 'RMIS_IBT_Msg')

BEGIN

BEGIN TRY

EXEC Eur_SYS_ImportTillIBTFromXML @MessageBody

END TRY

BEGIN CATCH

ROLLBACK TRANSACTION UndoReceive ;

SELECT @ErrorMessage = 'XML Failed to process with errorNO:' + CAST(ERROR_NUMBER() as VARCHAR(10)) + ' SEVERITY:' + cast(ERROR_SEVERITY() as varchar(10)) + ' State:' + Cast(ERROR_STATE() AS Varchar(10)) + ' Procedure:' + ISNULL(ERROR_PROCEDURE(), '-') + ' Message:' + ERROR_MESSAGE()

INSERT INTO SB_ERRORMSG (conversation_handle,MSG_Type,msg_data,date_created,ErrorTxt)

VALUES (@ConversationHandle,@messageTypeName,@MessageBody,GETDATE(),@ErrorMessage)

END CONVERSATION @conversationHandle WITH ERROR = 500 DESCRIPTION = 'Unable to process message.'

END CATCH ;

END

The above code is an example of my que handling procedure. i.e mark transaction call an sp to process the message if it errors rollback to the mark and put in a table for valuation. the problem i am having is the message handling sp can call another sp (i have put transction marks and error handling in) but they still fail and do an entire roll back i.e get this error

Msg 3931, Level 16, State 1, Line 10

The current transaction cannot be committed and cannot be rolled back to a savepoint. Roll back the entire transaction.

This then rolls back the entire transactiom and does not take the message of the queue thus it becoming a poison message.I would like to know is if any dequeing procedures fail (nested and at any level) how can i get the xml into an error table and message off the que without it disabling my queue.

View 6 Replies View Related

CLR_Auto_Event And CLR_Manual_Event Wait States

Mar 10, 2008

Hello,

I'm hoping someone can clarify what I am seeing below:

I have a SQL Server which the 2nd top wait state according to the SQL Server 2005 SP2 dashboard is "CLR_Auto_Event" and "CLR_Manual_Event". This server dosen't have CLR Integration enabled in "Surface Area Configuration", and we do not have any CLR applications. I've checked this dashboard many times and CLR never appeared before, and nothing has changed on the server interms of new databases, and we don't host any applications on the server. I ran a short profiler trace and didn't see any CLR Assembly Loads.

Is there something I'm missing....?

View 6 Replies View Related

Get Value From Columns Using List Of Tables

Feb 5, 2014

how do I get value from column using list of tables?

For example, I have list:

schema_name, table_name, column_name

How do I get:

schema_name, table_name, column_name, column_value

View 7 Replies View Related

How Do I List Columns Within Tables?

Mar 4, 2008

Hi All.
I'm an Oracle DBA who's currently being asked to look at a SqlServer Database. I need a list of columns per table, but am having trouble.
I'll admit I might be being lazy here, but I'm in a hurry and using the valueable resources available to me!! Would really appreciate the sql i need to copy into the query window. Much obliged!!
I need........
Table A
Column1 Datatype
Column2 Datatype
Table B
Column1 Datatype
Column2 Datatype
etc....
Many thanks.

View 7 Replies View Related

Select From A List Of Tables And Columns

Nov 26, 2014

The following returns all base tables within the database of type "varchar":

Code:
SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME FROM mydb.information_schema.columns
WHERE TABLE_SCHEMA = 'master' AND TABLE_CATALOG = 'mydb'
AND DATA_TYPE IN('varchar')"
AND TABLE_NAME IN(
SELECT TABLE_NAME FROM mydb.information_schema.tables
WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_CATALOG = 'mydb' AND TABLE_SCHEMA = 'master')

What I then want to do is... For each of these results:

Code:
select [COLUMN_NAME] from [TABLE_SCHEMA].[TABLE_NAME]
WHERE ID = 'test'

Is it possible to do this in one SQL command? Or do I manually have to do it for each in the list from my first query?

View 3 Replies View Related

T-SQL (SS2K8) :: CTE Has More Columns Than Were Specified In Column List

Mar 22, 2014

I get the following error , when I execute my CTE on SQL Server 2008 R2.CTE1 has more columns than were specified in the column list

--SQL CODE IS AS BELOW

WITH CTE1 (AUCTIONID,[Open Time], [Response SLA Broken], [Response SLA Deadline], [Response SLA Actual], [Responsetime SLA Broken Before Transfer], [Resolution SLA Broken], [Resolution SLADeadline], [Resolutiontime SLA Broken

[code]...

View 2 Replies View Related

List Of Columns From Tables Across Databases.

Jul 23, 2005

Hey guys,Couldn't find this anywhere in google.I want a list of all database column names for a specific table/viewfrom across database.I tried this...-----------------------------------------------------Select *[color=blue]>From Information_Schema.Columns[/color]-----------------------------------------------------I also tried this...-----------------------------------------------------select syscolumns.name, sysobjects.name, * from syscolumns, sysobjectswheresysobjects.id = syscolumns.idand (sysobjects.xtype='U' or sysobjects.xtype='S')-----------------------------------------------------These queries return information about the CURRENT database.But, if I want to do it ACROSS database or across servers.. how can Ido this?I will express my gratitude to everyone who is kind enough to answerthis question. (I've been stuck with this problem for a while now.)Thanks!OhMyGaw!

View 6 Replies View Related

List Columns In A Table In SQL 2005

Apr 2, 2008

Hi, I know sys.tables and sys.columns gives me a list of tables andcolumns in a SQL 2005 database.How can I list Columns in a specific Table please?Thanks in advance,Ronny

View 3 Replies View Related

ORDER BY Columns In SELECT List?

Jul 20, 2005

According to BOL, columns in an ORDER BY clause do not have to be in the SELECTcolumn list unless the SELECT includes DISTINCT, or the UNION operator.Is this a SQL Server thing, or SQL standard behavior? That is, if I were to writeabsolutely pure SQL-92, must columns in the ORDER BY clause be present in the SELECTlist?

View 1 Replies View Related

How To Get List (text) Of All Tables And Columns?

Jul 20, 2005

Is there a way using MS SQL Server and Enterprise Manager to get a textdocument (or perhaps even a Word document) listing all table names,column names, etc of a database?--Sugapablo------------------------------------http://www.sugapablo.com <--musichttp://www.sugapablo.net <--personal

View 2 Replies View Related

How To Get A List Of All Unused Columns Warnings

Feb 4, 2008

Hi,



I would like to get a list of all the unused columns, I have tons of files and fields in the package probably in the hundreds and I need to know which fields I am not using to see which fields are important not to miss out, so is there any way I can get them in a text file or any other format?



Thanks

View 5 Replies View Related

MSDE Install && Connection OK - Icon States Not Connected

May 22, 2004

Hi All

I installed the following in order:

1. .NET Framework Version 1.1 Redistributable
2. .NET Framework Version 1.1 Software Development Kit (SDK)
3. MSDE 2000 Rel A

In the command window I changed to the directory where MSDE 2000 Rel A was installed and typed in this:

setup.exe INSTANCENAME=MyDb DISABLENETWORKPROTOCOLS=1 SAPWD=<My SA PASSWORD>

MSDE installed successfully and the little icon appeared in the system tray, next to the clock. However, there was no little green arrow/triangle showing on the icon to show connection status as Connected.

4. ASP.NET Commerce Starter Kit

During the Starter Kit install a Connect to Database window opened - Connect to SQL or MSDE.

In the 'Server' field the following was automatically displayed:

STEVE-HOME/MyDb

Where STEVE-HOME is the name of my computer (changed from 'localhost') and MyDb is the instance name.

Thw 'Windows Authentication' radio button was selected by default. I left this unchanged, then clicked OK.

A window opened asking to test the connection. I clicked OK and the connection was successful.

(I didn't select the SQL Server authentication or enter a username, password or select a Database.)

The Starter Kit installed successfully and works fine. However, the SQL Server Service Manager icon states it is not connected when I mouse over it.

I opened the SQL Server Service Manager window and the Server and Services fields are blank.

Surely the Starter Kit wouldn't work if MSDE wasn't connected.

Can anyone advise on how to get the icon to show it is connected

Your help would be greatly appreciated.

View 1 Replies View Related

ReportServer Service Bringing Down My DB !!!

Apr 19, 2007

hi,

I have reporting service 2000 . it has started to make queries to database (my datasource), those queries are NOT my report server queries ..i do not know why its querying database for no reason :-(



any idea ?? please help,

-blue

View 1 Replies View Related

T-SQL (SS2K8) :: Query To List Rows Into Columns?

Aug 10, 2015

I have requirement to list each row into column. I have tried with pivot query but unable to get it. I am using SQL Server 2008 database.

Here is the sample data:

CREATE TABLE dbo.test (
action_id numeric,
action VARCHAR(20) NOT NULL,

[Code].....

View 3 Replies View Related

Get A List Of Output Columns On Script Transformation

Feb 13, 2007

I am using a script component to transform data. In the script component I created a bunch of fields for the output. Is there any way to loop through that list of columns? Is there code I can use in the script component to access the names, data types, data etc?

I saw a lot of informaiton on the OutputColumnCollection as part of some IDTSOuput90 thing (greek to me). As best I can guess this is for creating your own new columns, but can I see what columns are already defined via the script interface?

View 2 Replies View Related

Make A Check Constraint That States First 3 Characters Of CustomerID Field

May 5, 2015

I have a table where i have to make a check constraint that states the first 3 characters of the customerid field must be the first 3 characters of the company name I am so lost I looked everywhere.

View 2 Replies View Related

Query Bringing Back Too Many Records

May 1, 2015

I'm written a query to pull adjustments made on customer accounts, and I am attempting to pull in the payment associated with the adjustments. I'm using a single account to test my query and somewhere in my final output select statement I'm doing something that is bringing me back more records than I want. The code I have written is:

IF OBJECT_ID('TEMPDB..#TMP1O') IS NOT NULL DROP TABLE #TMP1O

select a.batch
,a.acctcorp
,a.house
,a.cust
--,RIGHT (REPLICATE ('0',5) + CONVERT(VARCHAR(5),A.acctcorp),5) +

[Code] ....

I've tried making changes within my where statement and parameters, but so far I've come up emtpy.

View 9 Replies View Related

Problems Bringing Up Project REAL

Mar 19, 2007

Most of the installation went well. I got to the point of attaching the
source database, but had problems attching the warehouse database:



Database 'REAL_Warehouse_Sample_V6' cannot be started in this edition
of SQL Server because it contains a partition function 'pf_Range_Fact'.
Only Enterprise edition of SQL Server supports partitioning.



I am running standard edition at mey development workstation, the only
one we have running. I do not necessarily need to see partitioning
working. But sounds like I will need to install Enterprise edition at
my development computer to go down this path of discovery? Anyone been
able to do otherwise?



Is there any way to get in and look at the stored procedures at least, or schemas?



Even after going back, it was not clear to me from the prerequisit list that Enterprise edition was required for this.

View 3 Replies View Related

Error Output Is Bringing Too Many Rows With It

May 10, 2007

I've got a Derived Columns component as part of a data flow. On this I've set the error output for my columns to Redirect Row in all cases. I've set a data watcher on the error output and then ran the package.



There are several rows which I'm expecting to fail - about 3 of them. These fail but there are also another 697 which seem to have no problem. So I fixed one of the problem columns in the source data and then re-ran the package. I only updated one row in the source so this row no longer appeared in the error output, but neither did several hundred of the other rows.



Is it possible that the error output has been tripped for that one row but for some reason it sends several hundred more rows? The ids on these additional rows follow on from the erroneous row, and when I fix that row the rows following it no longer appear in the error output.

View 5 Replies View Related

Bringing Data Into A Flat File

Apr 18, 2007

I am trying to bring in the result fo a query to a flat file. The source and destination connections are oK, the mapping is also correct. However I get the following error during execution:



[Flat File Destination [507]] Error: No column was specified to allow the component to advance through the file.

followed by this:

[DTS.Pipeline] Error: component "Flat File Destination" (507) failed the pre-execute phase and returned error code 0xC02020F0.



What is the fix?

View 7 Replies View Related

Selecting Only The List Of Columns From A Table Based On Input

Apr 17, 2008

Hi,
i have a table like below

table:-
id col2 col3 col4 col5 col6
1 2 3 4 5 6
2 5 8 4 7 6
3 4 8 2 6 9
4 2 5 8 6 3
5 6 9 5 5 9

i want to write a stored procedure where i pass column names a parameters and i want to get result based on that
For ex:-
if i pass the parameters as
col3 and col5 where id =1 then i should the result as

id col3 col4 col5
1 3 4 5

and if i pass input as col2and col6 where id =3, the result should be
id col2 col3 col4 col5 col6
3 4 8 2 6 9

can anyone help on this??

View 3 Replies View Related

Return A List Of New Tables Or Columns Which Do Not Exist In A Database

Mar 24, 2008



What SQL statement can i run to return a list of new tables or columns that exist in the Sales Database on Server A, which do not exist in the Sales Database in Server B.

Server A and Server B are linked servers.

I am using SQL Server 2005. Thanks.

View 1 Replies View Related

PMML: One Node In A Decision Tree Containing Two States Of An Attribute As The Rule For Splitting?

Sep 22, 2006

Hi,
is there a way to import a decision tree-model from pmml where a node contains two or more states of an attribute as the split-rule?


Example:

...
<Node recordCount="600">
<CompoundPredicate booleanOperator="or">
<SimplePredicate field="color" operator="equal" value="red" />
<SimplePredicate field="color" operator="equal" value="green" />
</CompoundPredicate>
<ScoreDistribution value="true" recordCount="200"/>
<ScoreDistribution value="false" recordCount="400"/>
</Node>
...

This node shoud contain all cases, whose color is red or green (The Microsoft DecisionTree-Algorithm would build a model with two steps like red/ not red and then green / not green). According to the DMG, this is valid PMML 2.1, but when trying to import the server complains about an unexpected value in the SimplePredicate-tag.

How can i import such a node in SqlServer 2005?

Thank you in advance for any help

Chris

View 8 Replies View Related







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