Tuesday, May 14, 2013

[SQL Server] linked tables

[SQL Server] linked tables


linked tables

Posted: 14 May 2013 06:31 AM PDT

I have a SQL server express that I'm using to learn how SQL server works. Up till this point I've done all my DB work in Access. I'm now beginning to develop vb.net applications for web and want to learn to use a DB designed for web. Here's what I don't yet know/can't figure out:My company has several access databases that use linked tables to share data. I used the import wizard to import each .mdb file in as a seperate database in my SQL server. I now want to regenerate the linked tables in SQL server such that DB1 points to a table in DB2. I tried using the SQL server management utility, but couldn't figure this out. Can someone help?Mike

SQL vs LINQ

Posted: 14 May 2013 10:55 AM PDT

Is SQL becoming outdated soon ??? AS new LINQ is all around us.... Do we have to learn LINQ for future programming or having knowledge and experience in SQL is enough!!!

Syntax Check

Posted: 14 May 2013 07:28 AM PDT

When I am typing in a new sqlquery how can I turn on the syntax check option or whatever it is called. In VBA for access as I type a list comes up validating what I am typing. Is there something like that for SQL?

how to deny logins

Posted: 14 May 2013 03:43 AM PDT

Hi all,I've copied a database to a new server. How do I make database on original server inaccessible to users while I am checking that everything is OK with the copy? And how to reverse it?Thanks,

Linking tables

Posted: 13 May 2013 11:31 PM PDT

When linking your access tables to SQL what issues would you make sure to deal with before linking the tables?

THE CASE of the overwriting logic

Posted: 13 May 2013 08:29 PM PDT

Hi All,I have a CASE statement that checks if the date column is NULL or NOT, if there is a data then 'Yes' in the 'Enquired_Y_N' column and if it is NULL then 'NO' in the 'Enquired_Y_N' column but the select statement below is assigning incorrect Yes and NO into the 'Enquired_Y_N' column. [code="sql"]SELECT [Response] , CASE WHEN [p].[Response] = 13053 THEN 'Y' WHEN [p].[Response] = 13052 THEN 'N' WHEN [p].[ResponseDate] is not null THEN 'Y' WHEN [p].[ResponseDate] is null THEN 'N' END AS Enquired_Y_N ,CONSTITUENT_ID ,[ResponseDate] FROM [dbo].[table1] p[/code][b]Sample Data[/b][code="sql"]Create table table1(Response int ,CONSTITUENT_ID INT,ResponseDate INT,EventID Varchar (50))INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('NULL','1774051','NULL','LEG_BLA_2012');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('NULL','1774056','NULL','LEG_BRA_2013');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('NULL','1774081','NULL','LEG_UCK_2013');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('NULL','1774107','NULL','LEG_BRA_2013');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('NULL','1774114','NULL','LEG_EXET_2012');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('13053','1039434','NULL','LB02');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('13053','1039551','NULL','RSA');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('13053','1041345','NULL','LB02');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('NULL','1829692','20130117','BB0002');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('13053','1017871','NULL','PW03');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('13053','1017871','NULL','KLT1');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('13052','1774190','20121114','BB0001');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('13052','1774190','20121113','BB0002');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('NULL','NULL','1774190','20121113','BB0003');INSERT INTO table1 (Response,CONSTITUENT_ID,ResponseDate,EventID) VALUES ('13052','1774190','20121113','BB0004');[/code]Wanted Results below – [code="sql"]Create table Wanted_Results(Response int ,CONSTITUENT_ID INT,ResponseDate INT,EventID Varchar (50))INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('NULL','N','1774051','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('NULL','N','1774056','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('NULL','N','1774081','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('NULL','N','1774107','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('NULL','N','1774114','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('13053','N','1039434','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('13053','N','1039551','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('13053','N','1041345','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('NULL','Y','1829692','20130117');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('13053','N','1017871','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('13053','N','1017871','NULL');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('13052','Y','1774190','20121114');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('13052','Y','1774190','20121113');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('NULL','Y','1774190','20121113');INSERT INTO Wanted_Results (Response,Enquired_Y_N,CONSTITUENT_ID,ResponseDate) VALUES ('13052','Y','1774190','20121113');[/code]Any help will Appreciated!!Thanks

No comments:

Post a Comment

Search This Blog